[TS] Update auto-generated bindings to 0.0.117
[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_UnrecoverableError;
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_UnrecoverableError: 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 LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
356         switch (ord) {
357                 case 0: return LDKHTLCClaim_OfferedTimeout;
358                 case 1: return LDKHTLCClaim_OfferedPreimage;
359                 case 2: return LDKHTLCClaim_AcceptedTimeout;
360                 case 3: return LDKHTLCClaim_AcceptedPreimage;
361                 case 4: return LDKHTLCClaim_Revocation;
362         }
363         abort();
364 }
365 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
366         switch (val) {
367                 case LDKHTLCClaim_OfferedTimeout: return 0;
368                 case LDKHTLCClaim_OfferedPreimage: return 1;
369                 case LDKHTLCClaim_AcceptedTimeout: return 2;
370                 case LDKHTLCClaim_AcceptedPreimage: return 3;
371                 case LDKHTLCClaim_Revocation: return 4;
372                 default: abort();
373         }
374 }
375 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
376         switch (ord) {
377                 case 0: return LDKIOError_NotFound;
378                 case 1: return LDKIOError_PermissionDenied;
379                 case 2: return LDKIOError_ConnectionRefused;
380                 case 3: return LDKIOError_ConnectionReset;
381                 case 4: return LDKIOError_ConnectionAborted;
382                 case 5: return LDKIOError_NotConnected;
383                 case 6: return LDKIOError_AddrInUse;
384                 case 7: return LDKIOError_AddrNotAvailable;
385                 case 8: return LDKIOError_BrokenPipe;
386                 case 9: return LDKIOError_AlreadyExists;
387                 case 10: return LDKIOError_WouldBlock;
388                 case 11: return LDKIOError_InvalidInput;
389                 case 12: return LDKIOError_InvalidData;
390                 case 13: return LDKIOError_TimedOut;
391                 case 14: return LDKIOError_WriteZero;
392                 case 15: return LDKIOError_Interrupted;
393                 case 16: return LDKIOError_Other;
394                 case 17: return LDKIOError_UnexpectedEof;
395         }
396         abort();
397 }
398 static inline int32_t LDKIOError_to_js(LDKIOError val) {
399         switch (val) {
400                 case LDKIOError_NotFound: return 0;
401                 case LDKIOError_PermissionDenied: return 1;
402                 case LDKIOError_ConnectionRefused: return 2;
403                 case LDKIOError_ConnectionReset: return 3;
404                 case LDKIOError_ConnectionAborted: return 4;
405                 case LDKIOError_NotConnected: return 5;
406                 case LDKIOError_AddrInUse: return 6;
407                 case LDKIOError_AddrNotAvailable: return 7;
408                 case LDKIOError_BrokenPipe: return 8;
409                 case LDKIOError_AlreadyExists: return 9;
410                 case LDKIOError_WouldBlock: return 10;
411                 case LDKIOError_InvalidInput: return 11;
412                 case LDKIOError_InvalidData: return 12;
413                 case LDKIOError_TimedOut: return 13;
414                 case LDKIOError_WriteZero: return 14;
415                 case LDKIOError_Interrupted: return 15;
416                 case LDKIOError_Other: return 16;
417                 case LDKIOError_UnexpectedEof: return 17;
418                 default: abort();
419         }
420 }
421 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
422         switch (ord) {
423                 case 0: return LDKLevel_Gossip;
424                 case 1: return LDKLevel_Trace;
425                 case 2: return LDKLevel_Debug;
426                 case 3: return LDKLevel_Info;
427                 case 4: return LDKLevel_Warn;
428                 case 5: return LDKLevel_Error;
429         }
430         abort();
431 }
432 static inline int32_t LDKLevel_to_js(LDKLevel val) {
433         switch (val) {
434                 case LDKLevel_Gossip: return 0;
435                 case LDKLevel_Trace: return 1;
436                 case LDKLevel_Debug: return 2;
437                 case LDKLevel_Info: return 3;
438                 case LDKLevel_Warn: return 4;
439                 case LDKLevel_Error: return 5;
440                 default: abort();
441         }
442 }
443 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
444         switch (ord) {
445                 case 0: return LDKNetwork_Bitcoin;
446                 case 1: return LDKNetwork_Testnet;
447                 case 2: return LDKNetwork_Regtest;
448                 case 3: return LDKNetwork_Signet;
449         }
450         abort();
451 }
452 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
453         switch (val) {
454                 case LDKNetwork_Bitcoin: return 0;
455                 case LDKNetwork_Testnet: return 1;
456                 case LDKNetwork_Regtest: return 2;
457                 case LDKNetwork_Signet: return 3;
458                 default: abort();
459         }
460 }
461 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
462         switch (ord) {
463                 case 0: return LDKPaymentFailureReason_RecipientRejected;
464                 case 1: return LDKPaymentFailureReason_UserAbandoned;
465                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
466                 case 3: return LDKPaymentFailureReason_PaymentExpired;
467                 case 4: return LDKPaymentFailureReason_RouteNotFound;
468                 case 5: return LDKPaymentFailureReason_UnexpectedError;
469         }
470         abort();
471 }
472 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
473         switch (val) {
474                 case LDKPaymentFailureReason_RecipientRejected: return 0;
475                 case LDKPaymentFailureReason_UserAbandoned: return 1;
476                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
477                 case LDKPaymentFailureReason_PaymentExpired: return 3;
478                 case LDKPaymentFailureReason_RouteNotFound: return 4;
479                 case LDKPaymentFailureReason_UnexpectedError: return 5;
480                 default: abort();
481         }
482 }
483 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
484         switch (ord) {
485                 case 0: return LDKRecipient_Node;
486                 case 1: return LDKRecipient_PhantomNode;
487         }
488         abort();
489 }
490 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
491         switch (val) {
492                 case LDKRecipient_Node: return 0;
493                 case LDKRecipient_PhantomNode: return 1;
494                 default: abort();
495         }
496 }
497 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
498         switch (ord) {
499                 case 0: return LDKRetryableSendFailure_PaymentExpired;
500                 case 1: return LDKRetryableSendFailure_RouteNotFound;
501                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
502         }
503         abort();
504 }
505 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
506         switch (val) {
507                 case LDKRetryableSendFailure_PaymentExpired: return 0;
508                 case LDKRetryableSendFailure_RouteNotFound: return 1;
509                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
510                 default: abort();
511         }
512 }
513 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
514         switch (ord) {
515                 case 0: return LDKSecp256k1Error_IncorrectSignature;
516                 case 1: return LDKSecp256k1Error_InvalidMessage;
517                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
518                 case 3: return LDKSecp256k1Error_InvalidSignature;
519                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
520                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
521                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
522                 case 7: return LDKSecp256k1Error_InvalidTweak;
523                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
524                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
525                 case 10: return LDKSecp256k1Error_InvalidParityValue;
526         }
527         abort();
528 }
529 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
530         switch (val) {
531                 case LDKSecp256k1Error_IncorrectSignature: return 0;
532                 case LDKSecp256k1Error_InvalidMessage: return 1;
533                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
534                 case LDKSecp256k1Error_InvalidSignature: return 3;
535                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
536                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
537                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
538                 case LDKSecp256k1Error_InvalidTweak: return 7;
539                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
540                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
541                 case LDKSecp256k1Error_InvalidParityValue: return 10;
542                 default: abort();
543         }
544 }
545 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
546         switch (ord) {
547                 case 0: return LDKSiPrefix_Milli;
548                 case 1: return LDKSiPrefix_Micro;
549                 case 2: return LDKSiPrefix_Nano;
550                 case 3: return LDKSiPrefix_Pico;
551         }
552         abort();
553 }
554 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
555         switch (val) {
556                 case LDKSiPrefix_Milli: return 0;
557                 case LDKSiPrefix_Micro: return 1;
558                 case LDKSiPrefix_Nano: return 2;
559                 case LDKSiPrefix_Pico: return 3;
560                 default: abort();
561         }
562 }
563 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
564         switch (ord) {
565                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
566                 case 1: return LDKSocketAddressParseError_InvalidInput;
567                 case 2: return LDKSocketAddressParseError_InvalidPort;
568                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
569         }
570         abort();
571 }
572 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
573         switch (val) {
574                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
575                 case LDKSocketAddressParseError_InvalidInput: return 1;
576                 case LDKSocketAddressParseError_InvalidPort: return 2;
577                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
578                 default: abort();
579         }
580 }
581 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
582         switch (ord) {
583                 case 0: return LDKUtxoLookupError_UnknownChain;
584                 case 1: return LDKUtxoLookupError_UnknownTx;
585         }
586         abort();
587 }
588 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
589         switch (val) {
590                 case LDKUtxoLookupError_UnknownChain: return 0;
591                 case LDKUtxoLookupError_UnknownTx: return 1;
592                 default: abort();
593         }
594 }
595 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
596         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
597         return ret;
598 }
599 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
600         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
601         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
602         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
603         return ret_arr;
604 }
605
606 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
607 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
608         if (!ptr_is_owned(thing)) return;
609         void* thing_ptr = untag_ptr(thing);
610         CHECK_ACCESS(thing_ptr);
611         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
612         FREE(untag_ptr(thing));
613         BigEndianScalar_free(thing_conv);
614 }
615
616 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
617         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
618         switch(obj->tag) {
619                 case LDKBech32Error_MissingSeparator: return 0;
620                 case LDKBech32Error_InvalidChecksum: return 1;
621                 case LDKBech32Error_InvalidLength: return 2;
622                 case LDKBech32Error_InvalidChar: return 3;
623                 case LDKBech32Error_InvalidData: return 4;
624                 case LDKBech32Error_InvalidPadding: return 5;
625                 case LDKBech32Error_MixedCase: return 6;
626                 default: abort();
627         }
628 }
629 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
630         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
631         assert(obj->tag == LDKBech32Error_InvalidChar);
632                         int32_t invalid_char_conv = obj->invalid_char;
633         return invalid_char_conv;
634 }
635 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
636         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
637         assert(obj->tag == LDKBech32Error_InvalidData);
638                         int8_t invalid_data_conv = obj->invalid_data;
639         return invalid_data_conv;
640 }
641 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
642         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
643         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
644         return ret;
645 }
646 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) {
647         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
648         LDKWitness ret_var = TxIn_get_witness(thing_conv);
649         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
650         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
651         Witness_free(ret_var);
652         return ret_arr;
653 }
654
655 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) {
656         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
657         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
658         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
659         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
660         CVec_u8Z_free(ret_var);
661         return ret_arr;
662 }
663
664 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) {
665         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
666         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
667         memcpy(ret_arr->elems, TxIn_get_previous_txid(thing_conv).data, 32);
668         return ret_arr;
669 }
670
671 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) {
672         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
673         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
674         return ret_conv;
675 }
676
677 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) {
678         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
679         int32_t ret_conv = TxIn_get_sequence(thing_conv);
680         return ret_conv;
681 }
682
683 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) {
684         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
685         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
686         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
687         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
688         CVec_u8Z_free(ret_var);
689         return ret_arr;
690 }
691
692 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) {
693         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
694         int64_t ret_conv = TxOut_get_value(thing_conv);
695         return ret_conv;
696 }
697
698 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
699         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
700         switch(obj->tag) {
701                 case LDKCOption_u64Z_Some: return 0;
702                 case LDKCOption_u64Z_None: return 1;
703                 default: abort();
704         }
705 }
706 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
707         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
708         assert(obj->tag == LDKCOption_u64Z_Some);
709                         int64_t some_conv = obj->some;
710         return some_conv;
711 }
712 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
713         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
714         for (size_t i = 0; i < ret.datalen; i++) {
715                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
716         }
717         return ret;
718 }
719 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
720         LDKRefund ret = *owner->contents.result;
721         ret.is_owned = false;
722         return ret;
723 }
724 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
725         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
726         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
727         uint64_t ret_ref = 0;
728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
730         return ret_ref;
731 }
732
733 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
734         LDKBolt12ParseError ret = *owner->contents.err;
735         ret.is_owned = false;
736         return ret;
737 }
738 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
739         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
740         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
741         uint64_t ret_ref = 0;
742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
744         return ret_ref;
745 }
746
747 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
748         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
749         switch(obj->tag) {
750                 case LDKRetry_Attempts: return 0;
751                 default: abort();
752         }
753 }
754 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
755         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
756         assert(obj->tag == LDKRetry_Attempts);
757                         int32_t attempts_conv = obj->attempts;
758         return attempts_conv;
759 }
760 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
761         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
762         switch(obj->tag) {
763                 case LDKDecodeError_UnknownVersion: return 0;
764                 case LDKDecodeError_UnknownRequiredFeature: return 1;
765                 case LDKDecodeError_InvalidValue: return 2;
766                 case LDKDecodeError_ShortRead: return 3;
767                 case LDKDecodeError_BadLengthDescriptor: return 4;
768                 case LDKDecodeError_Io: return 5;
769                 case LDKDecodeError_UnsupportedCompression: return 6;
770                 default: abort();
771         }
772 }
773 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
774         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
775         assert(obj->tag == LDKDecodeError_Io);
776                         uint32_t io_conv = LDKIOError_to_js(obj->io);
777         return io_conv;
778 }
779 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
780 CHECK(owner->result_ok);
781         return Retry_clone(&*owner->contents.result);
782 }
783 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
784         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
785         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
786         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
787         uint64_t ret_ref = tag_ptr(ret_copy, true);
788         return ret_ref;
789 }
790
791 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
792 CHECK(!owner->result_ok);
793         return DecodeError_clone(&*owner->contents.err);
794 }
795 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
796         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
797         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
798         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
799         uint64_t ret_ref = tag_ptr(ret_copy, true);
800         return ret_ref;
801 }
802
803 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
804         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
805         switch(obj->tag) {
806                 case LDKAPIError_APIMisuseError: return 0;
807                 case LDKAPIError_FeeRateTooHigh: return 1;
808                 case LDKAPIError_InvalidRoute: return 2;
809                 case LDKAPIError_ChannelUnavailable: return 3;
810                 case LDKAPIError_MonitorUpdateInProgress: return 4;
811                 case LDKAPIError_IncompatibleShutdownScript: return 5;
812                 default: abort();
813         }
814 }
815 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
816         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
817         assert(obj->tag == LDKAPIError_APIMisuseError);
818                         LDKStr err_str = obj->api_misuse_error.err;
819                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
820         return err_conv;
821 }
822 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
823         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
824         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
825                         LDKStr err_str = obj->fee_rate_too_high.err;
826                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
827         return err_conv;
828 }
829 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
830         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
831         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
832                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
833         return feerate_conv;
834 }
835 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
836         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
837         assert(obj->tag == LDKAPIError_InvalidRoute);
838                         LDKStr err_str = obj->invalid_route.err;
839                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
840         return err_conv;
841 }
842 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
843         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
844         assert(obj->tag == LDKAPIError_ChannelUnavailable);
845                         LDKStr err_str = obj->channel_unavailable.err;
846                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
847         return err_conv;
848 }
849 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
850         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
851         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
852                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
853                         uint64_t script_ref = 0;
854                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
855                         script_ref = tag_ptr(script_var.inner, false);
856         return script_ref;
857 }
858 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
859 CHECK(owner->result_ok);
860         return *owner->contents.result;
861 }
862 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
863         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
864         CResult_NoneAPIErrorZ_get_ok(owner_conv);
865 }
866
867 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
868 CHECK(!owner->result_ok);
869         return APIError_clone(&*owner->contents.err);
870 }
871 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
872         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
873         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
874         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
875         uint64_t ret_ref = tag_ptr(ret_copy, true);
876         return ret_ref;
877 }
878
879 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
880         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
881         for (size_t i = 0; i < ret.datalen; i++) {
882                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
883         }
884         return ret;
885 }
886 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
887         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
888         for (size_t i = 0; i < ret.datalen; i++) {
889                 ret.data[i] = APIError_clone(&orig->data[i]);
890         }
891         return ret;
892 }
893 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
894         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
895         switch(obj->tag) {
896                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
897                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
898                 default: abort();
899         }
900 }
901 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
902         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
903         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
904                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
905                         memcpy(some_arr->elems, obj->some.data, 32);
906         return some_arr;
907 }
908 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
909         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
910         switch(obj->tag) {
911                 case LDKCOption_CVec_u8ZZ_Some: return 0;
912                 case LDKCOption_CVec_u8ZZ_None: return 1;
913                 default: abort();
914         }
915 }
916 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
917         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
918         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
919                         LDKCVec_u8Z some_var = obj->some;
920                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
921                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
922         return some_arr;
923 }
924 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
925         LDKRecipientOnionFields ret = *owner->contents.result;
926         ret.is_owned = false;
927         return ret;
928 }
929 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
930         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
931         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
932         uint64_t ret_ref = 0;
933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
935         return ret_ref;
936 }
937
938 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
939 CHECK(!owner->result_ok);
940         return DecodeError_clone(&*owner->contents.err);
941 }
942 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
943         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
944         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
945         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
946         uint64_t ret_ref = tag_ptr(ret_copy, true);
947         return ret_ref;
948 }
949
950 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
951         return owner->a;
952 }
953 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
954         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
955         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
956         return ret_conv;
957 }
958
959 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
960         return CVec_u8Z_clone(&owner->b);
961 }
962 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
963         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
964         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
965         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
966         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
967         CVec_u8Z_free(ret_var);
968         return ret_arr;
969 }
970
971 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
972         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
973         for (size_t i = 0; i < ret.datalen; i++) {
974                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
975         }
976         return ret;
977 }
978 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
979         LDKRecipientOnionFields ret = *owner->contents.result;
980         ret.is_owned = false;
981         return ret;
982 }
983 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
984         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
985         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
986         uint64_t ret_ref = 0;
987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
989         return ret_ref;
990 }
991
992 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
993 CHECK(!owner->result_ok);
994         return *owner->contents.err;
995 }
996 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
997         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
998         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
999 }
1000
1001 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1002         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1003         for (size_t i = 0; i < ret.datalen; i++) {
1004                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1005         }
1006         return ret;
1007 }
1008 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
1009         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1010         switch(obj->tag) {
1011                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1012                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1013                 default: abort();
1014         }
1015 }
1016 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
1017         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1018         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1019                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1020                         ptrArray some_arr = NULL;
1021                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1022                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1023                         for (size_t m = 0; m < some_var.datalen; m++) {
1024                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
1025                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
1026                                 some_arr_ptr[m] = some_conv_12_arr;
1027                         }
1028                         
1029         return some_arr;
1030 }
1031 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1032 CHECK(owner->result_ok);
1033         return ThirtyTwoBytes_clone(&*owner->contents.result);
1034 }
1035 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1036         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1037         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1038         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1039         return ret_arr;
1040 }
1041
1042 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1043 CHECK(!owner->result_ok);
1044         return *owner->contents.err;
1045 }
1046 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1047         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1048         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1049 }
1050
1051 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1052         LDKBlindedPayInfo ret = *owner->contents.result;
1053         ret.is_owned = false;
1054         return ret;
1055 }
1056 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1057         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1058         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1059         uint64_t ret_ref = 0;
1060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1062         return ret_ref;
1063 }
1064
1065 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1066 CHECK(!owner->result_ok);
1067         return DecodeError_clone(&*owner->contents.err);
1068 }
1069 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1070         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1071         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1072         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1073         uint64_t ret_ref = tag_ptr(ret_copy, true);
1074         return ret_ref;
1075 }
1076
1077 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1078         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1079         ret.is_owned = false;
1080         return ret;
1081 }
1082 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1083         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1084         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1085         uint64_t ret_ref = 0;
1086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1088         return ret_ref;
1089 }
1090
1091 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1092 CHECK(!owner->result_ok);
1093         return DecodeError_clone(&*owner->contents.err);
1094 }
1095 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1096         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1097         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1098         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1099         uint64_t ret_ref = tag_ptr(ret_copy, true);
1100         return ret_ref;
1101 }
1102
1103 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1104         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1105         ret.is_owned = false;
1106         return ret;
1107 }
1108 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1109         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1110         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1111         uint64_t ret_ref = 0;
1112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1114         return ret_ref;
1115 }
1116
1117 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1118 CHECK(!owner->result_ok);
1119         return DecodeError_clone(&*owner->contents.err);
1120 }
1121 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1122         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1123         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1124         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1125         uint64_t ret_ref = tag_ptr(ret_copy, true);
1126         return ret_ref;
1127 }
1128
1129 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1130         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1131         switch(obj->tag) {
1132                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1133                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1134                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1135                 default: abort();
1136         }
1137 }
1138 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1139         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1140         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1141                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1142                         uint64_t outpoint_ref = 0;
1143                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1144                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1145         return outpoint_ref;
1146 }
1147 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1148         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1149         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1150                         LDKTxOut* output_ref = &obj->static_output.output;
1151         return tag_ptr(output_ref, false);
1152 }
1153 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1154         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1155         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1156                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1157                         uint64_t delayed_payment_output_ref = 0;
1158                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1159                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1160         return delayed_payment_output_ref;
1161 }
1162 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1163         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1164         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1165                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1166                         uint64_t static_payment_output_ref = 0;
1167                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1168                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1169         return static_payment_output_ref;
1170 }
1171 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1172 CHECK(owner->result_ok);
1173         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1174 }
1175 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1176         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1177         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1178         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1179         uint64_t ret_ref = tag_ptr(ret_copy, true);
1180         return ret_ref;
1181 }
1182
1183 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1184 CHECK(!owner->result_ok);
1185         return DecodeError_clone(&*owner->contents.err);
1186 }
1187 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1188         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1189         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1190         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1191         uint64_t ret_ref = tag_ptr(ret_copy, true);
1192         return ret_ref;
1193 }
1194
1195 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1196         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1197         for (size_t i = 0; i < ret.datalen; i++) {
1198                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1199         }
1200         return ret;
1201 }
1202 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1203         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1204         for (size_t i = 0; i < ret.datalen; i++) {
1205                 ret.data[i] = TxOut_clone(&orig->data[i]);
1206         }
1207         return ret;
1208 }
1209 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1210         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1211         switch(obj->tag) {
1212                 case LDKCOption_u32Z_Some: return 0;
1213                 case LDKCOption_u32Z_None: return 1;
1214                 default: abort();
1215         }
1216 }
1217 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1218         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1219         assert(obj->tag == LDKCOption_u32Z_Some);
1220                         int32_t some_conv = obj->some;
1221         return some_conv;
1222 }
1223 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8ZusizeZ_get_a(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
1224         return CVec_u8Z_clone(&owner->a);
1225 }
1226 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_get_a"))) TS_C2Tuple_CVec_u8ZusizeZ_get_a(uint64_t owner) {
1227         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
1228         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8ZusizeZ_get_a(owner_conv);
1229         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1230         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1231         CVec_u8Z_free(ret_var);
1232         return ret_arr;
1233 }
1234
1235 static inline uintptr_t C2Tuple_CVec_u8ZusizeZ_get_b(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
1236         return owner->b;
1237 }
1238 uint32_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_get_b"))) TS_C2Tuple_CVec_u8ZusizeZ_get_b(uint64_t owner) {
1239         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
1240         uint32_t ret_conv = C2Tuple_CVec_u8ZusizeZ_get_b(owner_conv);
1241         return ret_conv;
1242 }
1243
1244 static inline struct LDKC2Tuple_CVec_u8ZusizeZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
1245 CHECK(owner->result_ok);
1246         return C2Tuple_CVec_u8ZusizeZ_clone(&*owner->contents.result);
1247 }
1248 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(uint64_t owner) {
1249         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
1250         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
1251         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(owner_conv);
1252         return tag_ptr(ret_conv, true);
1253 }
1254
1255 static inline void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
1256 CHECK(!owner->result_ok);
1257         return *owner->contents.err;
1258 }
1259 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(uint64_t owner) {
1260         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
1261         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv);
1262 }
1263
1264 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1265 CHECK(owner->result_ok);
1266         return *owner->contents.result;
1267 }
1268 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1269         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1270         CResult_NoneNoneZ_get_ok(owner_conv);
1271 }
1272
1273 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1274 CHECK(!owner->result_ok);
1275         return *owner->contents.err;
1276 }
1277 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1278         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1279         CResult_NoneNoneZ_get_err(owner_conv);
1280 }
1281
1282 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1283         return owner->a;
1284 }
1285 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1286         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1287         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1288         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1289         return ret_arr;
1290 }
1291
1292 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1293         return owner->b;
1294 }
1295 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1296         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1297         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1298         ptrArray ret_arr = NULL;
1299         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1300         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1301         for (size_t m = 0; m < ret_var.datalen; m++) {
1302                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1303                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1304                 ret_arr_ptr[m] = ret_conv_12_arr;
1305         }
1306         
1307         return ret_arr;
1308 }
1309
1310 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1311 CHECK(owner->result_ok);
1312         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1313 }
1314 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1315         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1316         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1317         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1318         return tag_ptr(ret_conv, true);
1319 }
1320
1321 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1322 CHECK(!owner->result_ok);
1323         return *owner->contents.err;
1324 }
1325 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1326         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1327         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1328 }
1329
1330 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1331 CHECK(owner->result_ok);
1332         return *owner->contents.result;
1333 }
1334 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1335         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1336         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1337         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1338         return ret_arr;
1339 }
1340
1341 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1342 CHECK(!owner->result_ok);
1343         return *owner->contents.err;
1344 }
1345 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1346         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1347         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1348 }
1349
1350 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1351 CHECK(owner->result_ok);
1352         return *owner->contents.result;
1353 }
1354 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1355         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1356         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1357         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1358         return ret_arr;
1359 }
1360
1361 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1362 CHECK(!owner->result_ok);
1363         return *owner->contents.err;
1364 }
1365 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1366         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1367         CResult_PublicKeyNoneZ_get_err(owner_conv);
1368 }
1369
1370 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1371         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1372         switch(obj->tag) {
1373                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1374                 case LDKCOption_BigEndianScalarZ_None: return 1;
1375                 default: abort();
1376         }
1377 }
1378 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1379         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1380         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1381                         LDKBigEndianScalar* some_ref = &obj->some;
1382         return tag_ptr(some_ref, false);
1383 }
1384 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1385 CHECK(owner->result_ok);
1386         return *owner->contents.result;
1387 }
1388 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1389         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1390         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1391         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1392         return ret_arr;
1393 }
1394
1395 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1396 CHECK(!owner->result_ok);
1397         return *owner->contents.err;
1398 }
1399 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1400         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1401         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1402 }
1403
1404 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1405 CHECK(owner->result_ok);
1406         return *owner->contents.result;
1407 }
1408 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1409         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1410         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1411         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1412         return ret_arr;
1413 }
1414
1415 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1416 CHECK(!owner->result_ok);
1417         return *owner->contents.err;
1418 }
1419 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1420         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1421         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1422 }
1423
1424 typedef struct LDKChannelSigner_JCalls {
1425         atomic_size_t refcnt;
1426         uint32_t instance_ptr;
1427 } LDKChannelSigner_JCalls;
1428 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1429         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1430         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1431                 FREE(j_calls);
1432         }
1433 }
1434 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1435         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1436         int64_t idx_conv = idx;
1437         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1438         LDKPublicKey ret_ref;
1439         CHECK(ret->arr_len == 33);
1440         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1441         return ret_ref;
1442 }
1443 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1444         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1445         int64_t idx_conv = idx;
1446         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1447         LDKThirtyTwoBytes ret_ref;
1448         CHECK(ret->arr_len == 32);
1449         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1450         return ret_ref;
1451 }
1452 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
1453         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1454         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1455         uint64_t holder_tx_ref = 0;
1456         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1457         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1458         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1459         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
1460         ptrArray preimages_arr = NULL;
1461         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1462         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1463         for (size_t m = 0; m < preimages_var.datalen; m++) {
1464                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1465                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1466                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1467         }
1468         
1469         FREE(preimages_var.data);
1470         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 2, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1471         void* ret_ptr = untag_ptr(ret);
1472         CHECK_ACCESS(ret_ptr);
1473         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1474         FREE(untag_ptr(ret));
1475         return ret_conv;
1476 }
1477 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1478         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1479         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 3, 0, 0, 0, 0, 0, 0);
1480         LDKThirtyTwoBytes ret_ref;
1481         CHECK(ret->arr_len == 32);
1482         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1483         return ret_ref;
1484 }
1485 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1486         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1487         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1488         uint64_t channel_parameters_ref = 0;
1489         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1490         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1491         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1492         js_invoke_function_buuuuu(j_calls->instance_ptr, 4, channel_parameters_ref, 0, 0, 0, 0, 0);
1493 }
1494 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1495         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1496         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1497 }
1498 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1499         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1500         atomic_init(&calls->refcnt, 1);
1501         calls->instance_ptr = o;
1502
1503         LDKChannelPublicKeys pubkeys_conv;
1504         pubkeys_conv.inner = untag_ptr(pubkeys);
1505         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1506         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1507
1508         LDKChannelSigner ret = {
1509                 .this_arg = (void*) calls,
1510                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1511                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1512                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1513                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1514                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1515                 .free = LDKChannelSigner_JCalls_free,
1516                 .pubkeys = pubkeys_conv,
1517                 .set_pubkeys = NULL,
1518         };
1519         return ret;
1520 }
1521 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1522         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1523         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1524         return tag_ptr(res_ptr, true);
1525 }
1526 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1527         void* this_arg_ptr = untag_ptr(this_arg);
1528         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1529         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1530         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1531         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1532         return ret_arr;
1533 }
1534
1535 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1536         void* this_arg_ptr = untag_ptr(this_arg);
1537         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1538         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1539         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1540         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1541         return ret_arr;
1542 }
1543
1544 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) {
1545         void* this_arg_ptr = untag_ptr(this_arg);
1546         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1547         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1548         LDKHolderCommitmentTransaction holder_tx_conv;
1549         holder_tx_conv.inner = untag_ptr(holder_tx);
1550         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1551         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1552         holder_tx_conv.is_owned = false;
1553         LDKCVec_ThirtyTwoBytesZ preimages_constr;
1554         preimages_constr.datalen = preimages->arr_len;
1555         if (preimages_constr.datalen > 0)
1556                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1557         else
1558                 preimages_constr.data = NULL;
1559         int8_tArray* preimages_vals = (void*) preimages->elems;
1560         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1561                 int8_tArray preimages_conv_12 = preimages_vals[m];
1562                 LDKThirtyTwoBytes preimages_conv_12_ref;
1563                 CHECK(preimages_conv_12->arr_len == 32);
1564                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1565                 preimages_constr.data[m] = preimages_conv_12_ref;
1566         }
1567         FREE(preimages);
1568         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1569         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
1570         return tag_ptr(ret_conv, true);
1571 }
1572
1573 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1574         void* this_arg_ptr = untag_ptr(this_arg);
1575         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1576         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1577         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1578         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1579         return ret_arr;
1580 }
1581
1582 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1583         void* this_arg_ptr = untag_ptr(this_arg);
1584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1585         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1586         LDKChannelTransactionParameters channel_parameters_conv;
1587         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1588         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1589         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1590         channel_parameters_conv.is_owned = false;
1591         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1592 }
1593
1594 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1595         if (this_arg->set_pubkeys != NULL)
1596                 this_arg->set_pubkeys(this_arg);
1597         return this_arg->pubkeys;
1598 }
1599 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1600         void* this_arg_ptr = untag_ptr(this_arg);
1601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1602         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1603         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1604         uint64_t ret_ref = 0;
1605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1607         return ret_ref;
1608 }
1609
1610 typedef struct LDKEcdsaChannelSigner_JCalls {
1611         atomic_size_t refcnt;
1612         uint32_t instance_ptr;
1613         LDKChannelSigner_JCalls* ChannelSigner;
1614 } LDKEcdsaChannelSigner_JCalls;
1615 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1616         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1617         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1618                 FREE(j_calls);
1619         }
1620 }
1621 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
1622         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1623         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1624         uint64_t commitment_tx_ref = 0;
1625         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1626         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1627         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1628         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
1629         ptrArray preimages_arr = NULL;
1630         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1631         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1632         for (size_t m = 0; m < preimages_var.datalen; m++) {
1633                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1634                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1635                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1636         }
1637         
1638         FREE(preimages_var.data);
1639         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 5, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1640         void* ret_ptr = untag_ptr(ret);
1641         CHECK_ACCESS(ret_ptr);
1642         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1643         FREE(untag_ptr(ret));
1644         return ret_conv;
1645 }
1646 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1647         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1648         int64_t idx_conv = idx;
1649         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1650         memcpy(secret_arr->elems, *secret, 32);
1651         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1652         void* ret_ptr = untag_ptr(ret);
1653         CHECK_ACCESS(ret_ptr);
1654         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1655         FREE(untag_ptr(ret));
1656         return ret_conv;
1657 }
1658 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1659         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1660         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1661         uint64_t commitment_tx_ref = 0;
1662         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1663         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1664         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1665         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1666         void* ret_ptr = untag_ptr(ret);
1667         CHECK_ACCESS(ret_ptr);
1668         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1669         FREE(untag_ptr(ret));
1670         return ret_conv;
1671 }
1672 LDKCResult_ECDSASignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
1673         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1674         LDKTransaction justice_tx_var = justice_tx;
1675         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1676         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1677         Transaction_free(justice_tx_var);
1678         uint32_t input_conv = input;
1679         int64_t amount_conv = amount;
1680         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1681         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1682         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);
1683         void* ret_ptr = untag_ptr(ret);
1684         CHECK_ACCESS(ret_ptr);
1685         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1686         FREE(untag_ptr(ret));
1687         return ret_conv;
1688 }
1689 LDKCResult_ECDSASignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1690         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1691         LDKTransaction justice_tx_var = justice_tx;
1692         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1693         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1694         Transaction_free(justice_tx_var);
1695         uint32_t input_conv = input;
1696         int64_t amount_conv = amount;
1697         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1698         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1699         LDKHTLCOutputInCommitment htlc_var = *htlc;
1700         uint64_t htlc_ref = 0;
1701         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1702         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1703         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1704         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);
1705         void* ret_ptr = untag_ptr(ret);
1706         CHECK_ACCESS(ret_ptr);
1707         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1708         FREE(untag_ptr(ret));
1709         return ret_conv;
1710 }
1711 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1712         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1713         LDKTransaction htlc_tx_var = htlc_tx;
1714         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1715         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1716         Transaction_free(htlc_tx_var);
1717         uint32_t input_conv = input;
1718         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1719         uint64_t htlc_descriptor_ref = 0;
1720         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1721         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1722         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1723         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);
1724         void* ret_ptr = untag_ptr(ret);
1725         CHECK_ACCESS(ret_ptr);
1726         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1727         FREE(untag_ptr(ret));
1728         return ret_conv;
1729 }
1730 LDKCResult_ECDSASignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1731         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1732         LDKTransaction htlc_tx_var = htlc_tx;
1733         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1734         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1735         Transaction_free(htlc_tx_var);
1736         uint32_t input_conv = input;
1737         int64_t amount_conv = amount;
1738         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
1739         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
1740         LDKHTLCOutputInCommitment htlc_var = *htlc;
1741         uint64_t htlc_ref = 0;
1742         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1743         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1744         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1745         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);
1746         void* ret_ptr = untag_ptr(ret);
1747         CHECK_ACCESS(ret_ptr);
1748         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1749         FREE(untag_ptr(ret));
1750         return ret_conv;
1751 }
1752 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1753         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1754         LDKClosingTransaction closing_tx_var = *closing_tx;
1755         uint64_t closing_tx_ref = 0;
1756         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
1757         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1758         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
1759         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
1760         void* ret_ptr = untag_ptr(ret);
1761         CHECK_ACCESS(ret_ptr);
1762         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1763         FREE(untag_ptr(ret));
1764         return ret_conv;
1765 }
1766 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
1767         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1768         LDKTransaction anchor_tx_var = anchor_tx;
1769         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
1770         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
1771         Transaction_free(anchor_tx_var);
1772         uint32_t input_conv = input;
1773         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
1774         void* ret_ptr = untag_ptr(ret);
1775         CHECK_ACCESS(ret_ptr);
1776         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1777         FREE(untag_ptr(ret));
1778         return ret_conv;
1779 }
1780 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1781         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1782         LDKUnsignedChannelAnnouncement msg_var = *msg;
1783         uint64_t msg_ref = 0;
1784         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
1785         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1786         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
1787         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
1788         void* ret_ptr = untag_ptr(ret);
1789         CHECK_ACCESS(ret_ptr);
1790         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1791         FREE(untag_ptr(ret));
1792         return ret_conv;
1793 }
1794 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
1795         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
1796         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1797         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
1798 }
1799 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1800         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
1801         atomic_init(&calls->refcnt, 1);
1802         calls->instance_ptr = o;
1803
1804         LDKChannelPublicKeys pubkeys_conv;
1805         pubkeys_conv.inner = untag_ptr(pubkeys);
1806         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1807         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1808
1809         LDKEcdsaChannelSigner ret = {
1810                 .this_arg = (void*) calls,
1811                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
1812                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
1813                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
1814                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
1815                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
1816                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1817                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1818                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
1819                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
1820                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
1821                 .free = LDKEcdsaChannelSigner_JCalls_free,
1822                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
1823         };
1824         calls->ChannelSigner = ret.ChannelSigner.this_arg;
1825         return ret;
1826 }
1827 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1828         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
1829         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
1830         return tag_ptr(res_ptr, true);
1831 }
1832 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) {
1833         void* this_arg_ptr = untag_ptr(this_arg);
1834         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1835         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1836         LDKCommitmentTransaction commitment_tx_conv;
1837         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1838         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1839         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1840         commitment_tx_conv.is_owned = false;
1841         LDKCVec_ThirtyTwoBytesZ preimages_constr;
1842         preimages_constr.datalen = preimages->arr_len;
1843         if (preimages_constr.datalen > 0)
1844                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1845         else
1846                 preimages_constr.data = NULL;
1847         int8_tArray* preimages_vals = (void*) preimages->elems;
1848         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1849                 int8_tArray preimages_conv_12 = preimages_vals[m];
1850                 LDKThirtyTwoBytes preimages_conv_12_ref;
1851                 CHECK(preimages_conv_12->arr_len == 32);
1852                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1853                 preimages_constr.data[m] = preimages_conv_12_ref;
1854         }
1855         FREE(preimages);
1856         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
1857         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
1858         return tag_ptr(ret_conv, true);
1859 }
1860
1861 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) {
1862         void* this_arg_ptr = untag_ptr(this_arg);
1863         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1864         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1865         uint8_t secret_arr[32];
1866         CHECK(secret->arr_len == 32);
1867         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1868         uint8_t (*secret_ref)[32] = &secret_arr;
1869         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1870         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1871         return tag_ptr(ret_conv, true);
1872 }
1873
1874 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) {
1875         void* this_arg_ptr = untag_ptr(this_arg);
1876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1877         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1878         LDKHolderCommitmentTransaction commitment_tx_conv;
1879         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1880         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1881         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1882         commitment_tx_conv.is_owned = false;
1883         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
1884         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1885         return tag_ptr(ret_conv, true);
1886 }
1887
1888 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) {
1889         void* this_arg_ptr = untag_ptr(this_arg);
1890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1891         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1892         LDKTransaction justice_tx_ref;
1893         justice_tx_ref.datalen = justice_tx->arr_len;
1894         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1895         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1896         justice_tx_ref.data_is_owned = true;
1897         uint8_t per_commitment_key_arr[32];
1898         CHECK(per_commitment_key->arr_len == 32);
1899         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1900         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1901         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1902         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1903         return tag_ptr(ret_conv, true);
1904 }
1905
1906 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) {
1907         void* this_arg_ptr = untag_ptr(this_arg);
1908         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1909         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1910         LDKTransaction justice_tx_ref;
1911         justice_tx_ref.datalen = justice_tx->arr_len;
1912         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1913         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1914         justice_tx_ref.data_is_owned = true;
1915         uint8_t per_commitment_key_arr[32];
1916         CHECK(per_commitment_key->arr_len == 32);
1917         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1918         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1919         LDKHTLCOutputInCommitment htlc_conv;
1920         htlc_conv.inner = untag_ptr(htlc);
1921         htlc_conv.is_owned = ptr_is_owned(htlc);
1922         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
1923         htlc_conv.is_owned = false;
1924         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1925         *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);
1926         return tag_ptr(ret_conv, true);
1927 }
1928
1929 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) {
1930         void* this_arg_ptr = untag_ptr(this_arg);
1931         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1932         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1933         LDKTransaction htlc_tx_ref;
1934         htlc_tx_ref.datalen = htlc_tx->arr_len;
1935         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1936         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
1937         htlc_tx_ref.data_is_owned = true;
1938         LDKHTLCDescriptor htlc_descriptor_conv;
1939         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
1940         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
1941         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
1942         htlc_descriptor_conv.is_owned = false;
1943         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1944         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
1945         return tag_ptr(ret_conv, true);
1946 }
1947
1948 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) {
1949         void* this_arg_ptr = untag_ptr(this_arg);
1950         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1951         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1952         LDKTransaction htlc_tx_ref;
1953         htlc_tx_ref.datalen = htlc_tx->arr_len;
1954         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1955         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
1956         htlc_tx_ref.data_is_owned = true;
1957         LDKPublicKey per_commitment_point_ref;
1958         CHECK(per_commitment_point->arr_len == 33);
1959         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
1960         LDKHTLCOutputInCommitment htlc_conv;
1961         htlc_conv.inner = untag_ptr(htlc);
1962         htlc_conv.is_owned = ptr_is_owned(htlc);
1963         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
1964         htlc_conv.is_owned = false;
1965         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1966         *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);
1967         return tag_ptr(ret_conv, true);
1968 }
1969
1970 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
1971         void* this_arg_ptr = untag_ptr(this_arg);
1972         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1973         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1974         LDKClosingTransaction closing_tx_conv;
1975         closing_tx_conv.inner = untag_ptr(closing_tx);
1976         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
1977         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
1978         closing_tx_conv.is_owned = false;
1979         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1980         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
1981         return tag_ptr(ret_conv, true);
1982 }
1983
1984 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) {
1985         void* this_arg_ptr = untag_ptr(this_arg);
1986         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1987         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1988         LDKTransaction anchor_tx_ref;
1989         anchor_tx_ref.datalen = anchor_tx->arr_len;
1990         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
1991         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
1992         anchor_tx_ref.data_is_owned = true;
1993         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1994         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
1995         return tag_ptr(ret_conv, true);
1996 }
1997
1998 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) {
1999         void* this_arg_ptr = untag_ptr(this_arg);
2000         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2001         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2002         LDKUnsignedChannelAnnouncement msg_conv;
2003         msg_conv.inner = untag_ptr(msg);
2004         msg_conv.is_owned = ptr_is_owned(msg);
2005         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2006         msg_conv.is_owned = false;
2007         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2008         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2009         return tag_ptr(ret_conv, true);
2010 }
2011
2012 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2013         atomic_size_t refcnt;
2014         uint32_t instance_ptr;
2015         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2016         LDKChannelSigner_JCalls* ChannelSigner;
2017 } LDKWriteableEcdsaChannelSigner_JCalls;
2018 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2019         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2020         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2021                 FREE(j_calls);
2022         }
2023 }
2024 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2025         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2026         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2027         LDKCVec_u8Z ret_ref;
2028         ret_ref.datalen = ret->arr_len;
2029         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2030         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2031         return ret_ref;
2032 }
2033 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2034         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2035         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2036         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2037         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2038 }
2039 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2040         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2041         atomic_init(&calls->refcnt, 1);
2042         calls->instance_ptr = o;
2043
2044         LDKChannelPublicKeys pubkeys_conv;
2045         pubkeys_conv.inner = untag_ptr(pubkeys);
2046         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2047         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2048
2049         LDKWriteableEcdsaChannelSigner ret = {
2050                 .this_arg = (void*) calls,
2051                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2052                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2053                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2054                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2055         };
2056         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2057         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2058         return ret;
2059 }
2060 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2061         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2062         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2063         return tag_ptr(res_ptr, true);
2064 }
2065 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2066         void* this_arg_ptr = untag_ptr(this_arg);
2067         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2068         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2069         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2070         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2071         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2072         CVec_u8Z_free(ret_var);
2073         return ret_arr;
2074 }
2075
2076 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2077 CHECK(owner->result_ok);
2078         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2079 }
2080 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2081         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2082         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2083         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2084         return tag_ptr(ret_ret, true);
2085 }
2086
2087 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2088 CHECK(!owner->result_ok);
2089         return DecodeError_clone(&*owner->contents.err);
2090 }
2091 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2092         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2093         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2094         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2095         uint64_t ret_ref = tag_ptr(ret_copy, true);
2096         return ret_ref;
2097 }
2098
2099 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2100 CHECK(owner->result_ok);
2101         return CVec_u8Z_clone(&*owner->contents.result);
2102 }
2103 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2104         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2105         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2106         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2107         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2108         CVec_u8Z_free(ret_var);
2109         return ret_arr;
2110 }
2111
2112 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2113 CHECK(!owner->result_ok);
2114         return *owner->contents.err;
2115 }
2116 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2117         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2118         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2119 }
2120
2121 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2122         LDKShutdownScript ret = *owner->contents.result;
2123         ret.is_owned = false;
2124         return ret;
2125 }
2126 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2127         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2128         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2129         uint64_t ret_ref = 0;
2130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2132         return ret_ref;
2133 }
2134
2135 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2136 CHECK(!owner->result_ok);
2137         return *owner->contents.err;
2138 }
2139 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2140         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2141         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2142 }
2143
2144 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2145         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2146         switch(obj->tag) {
2147                 case LDKCOption_u16Z_Some: return 0;
2148                 case LDKCOption_u16Z_None: return 1;
2149                 default: abort();
2150         }
2151 }
2152 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2153         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2154         assert(obj->tag == LDKCOption_u16Z_Some);
2155                         int16_t some_conv = obj->some;
2156         return some_conv;
2157 }
2158 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2159         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2160         switch(obj->tag) {
2161                 case LDKCOption_boolZ_Some: return 0;
2162                 case LDKCOption_boolZ_None: return 1;
2163                 default: abort();
2164         }
2165 }
2166 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2167         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2168         assert(obj->tag == LDKCOption_boolZ_Some);
2169                         jboolean some_conv = obj->some;
2170         return some_conv;
2171 }
2172 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2173         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2174         for (size_t i = 0; i < ret.datalen; i++) {
2175                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2176         }
2177         return ret;
2178 }
2179 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2180 CHECK(owner->result_ok);
2181         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
2182 }
2183 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
2184         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2185         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
2186         ptrArray ret_arr = NULL;
2187         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
2188         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
2189         for (size_t m = 0; m < ret_var.datalen; m++) {
2190                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
2191                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
2192                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
2193                 CVec_u8Z_free(ret_conv_12_var);
2194                 ret_arr_ptr[m] = ret_conv_12_arr;
2195         }
2196         
2197         FREE(ret_var.data);
2198         return ret_arr;
2199 }
2200
2201 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2202 CHECK(!owner->result_ok);
2203         return *owner->contents.err;
2204 }
2205 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
2206         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2207         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
2208 }
2209
2210 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2211         LDKInMemorySigner ret = *owner->contents.result;
2212         ret.is_owned = false;
2213         return ret;
2214 }
2215 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2216         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2217         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2218         uint64_t ret_ref = 0;
2219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2221         return ret_ref;
2222 }
2223
2224 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2225 CHECK(!owner->result_ok);
2226         return DecodeError_clone(&*owner->contents.err);
2227 }
2228 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2229         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2230         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2231         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2232         uint64_t ret_ref = tag_ptr(ret_copy, true);
2233         return ret_ref;
2234 }
2235
2236 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2237 CHECK(owner->result_ok);
2238         return *owner->contents.result;
2239 }
2240 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
2241         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2242         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2243         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2244         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2245         return ret_arr;
2246 }
2247
2248 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2249 CHECK(!owner->result_ok);
2250         return *owner->contents.err;
2251 }
2252 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
2253         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2254         CResult_TransactionNoneZ_get_err(owner_conv);
2255 }
2256
2257 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2258         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2259         for (size_t i = 0; i < ret.datalen; i++) {
2260                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2261         }
2262         return ret;
2263 }
2264 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2265         LDKRoute ret = *owner->contents.result;
2266         ret.is_owned = false;
2267         return ret;
2268 }
2269 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2270         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2271         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2272         uint64_t ret_ref = 0;
2273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2275         return ret_ref;
2276 }
2277
2278 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2279         LDKLightningError ret = *owner->contents.err;
2280         ret.is_owned = false;
2281         return ret;
2282 }
2283 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2284         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2285         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2286         uint64_t ret_ref = 0;
2287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2289         return ret_ref;
2290 }
2291
2292 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2293         LDKInFlightHtlcs ret = *owner->contents.result;
2294         ret.is_owned = false;
2295         return ret;
2296 }
2297 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2298         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2299         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2300         uint64_t ret_ref = 0;
2301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2303         return ret_ref;
2304 }
2305
2306 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2307 CHECK(!owner->result_ok);
2308         return DecodeError_clone(&*owner->contents.err);
2309 }
2310 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2311         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2312         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2313         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2314         uint64_t ret_ref = tag_ptr(ret_copy, true);
2315         return ret_ref;
2316 }
2317
2318 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2319         LDKRouteHop ret = *owner->contents.result;
2320         ret.is_owned = false;
2321         return ret;
2322 }
2323 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2324         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2325         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2326         uint64_t ret_ref = 0;
2327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2329         return ret_ref;
2330 }
2331
2332 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2333 CHECK(!owner->result_ok);
2334         return DecodeError_clone(&*owner->contents.err);
2335 }
2336 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2337         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2338         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2339         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2340         uint64_t ret_ref = tag_ptr(ret_copy, true);
2341         return ret_ref;
2342 }
2343
2344 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2345         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2346         for (size_t i = 0; i < ret.datalen; i++) {
2347                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2348         }
2349         return ret;
2350 }
2351 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2352         LDKBlindedTail ret = *owner->contents.result;
2353         ret.is_owned = false;
2354         return ret;
2355 }
2356 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2357         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2358         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2359         uint64_t ret_ref = 0;
2360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2362         return ret_ref;
2363 }
2364
2365 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2366 CHECK(!owner->result_ok);
2367         return DecodeError_clone(&*owner->contents.err);
2368 }
2369 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2370         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2371         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2372         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2373         uint64_t ret_ref = tag_ptr(ret_copy, true);
2374         return ret_ref;
2375 }
2376
2377 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2378         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2379         for (size_t i = 0; i < ret.datalen; i++) {
2380                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2381         }
2382         return ret;
2383 }
2384 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2385         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2386         for (size_t i = 0; i < ret.datalen; i++) {
2387                 ret.data[i] = Path_clone(&orig->data[i]);
2388         }
2389         return ret;
2390 }
2391 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2392         LDKRoute ret = *owner->contents.result;
2393         ret.is_owned = false;
2394         return ret;
2395 }
2396 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2397         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2398         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2399         uint64_t ret_ref = 0;
2400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2402         return ret_ref;
2403 }
2404
2405 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2406 CHECK(!owner->result_ok);
2407         return DecodeError_clone(&*owner->contents.err);
2408 }
2409 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2410         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2411         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2412         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2413         uint64_t ret_ref = tag_ptr(ret_copy, true);
2414         return ret_ref;
2415 }
2416
2417 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2418         LDKRouteParameters ret = *owner->contents.result;
2419         ret.is_owned = false;
2420         return ret;
2421 }
2422 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2423         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2424         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2425         uint64_t ret_ref = 0;
2426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2428         return ret_ref;
2429 }
2430
2431 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2432 CHECK(!owner->result_ok);
2433         return DecodeError_clone(&*owner->contents.err);
2434 }
2435 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2436         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2437         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2438         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2439         uint64_t ret_ref = tag_ptr(ret_copy, true);
2440         return ret_ref;
2441 }
2442
2443 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2444         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2445         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2446         return ret;
2447 }
2448 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2449         LDKPaymentParameters ret = *owner->contents.result;
2450         ret.is_owned = false;
2451         return ret;
2452 }
2453 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2454         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2455         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2456         uint64_t ret_ref = 0;
2457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2459         return ret_ref;
2460 }
2461
2462 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2463 CHECK(!owner->result_ok);
2464         return DecodeError_clone(&*owner->contents.err);
2465 }
2466 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2467         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2468         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2469         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2470         uint64_t ret_ref = tag_ptr(ret_copy, true);
2471         return ret_ref;
2472 }
2473
2474 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2475         LDKBlindedPayInfo ret = owner->a;
2476         ret.is_owned = false;
2477         return ret;
2478 }
2479 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2480         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2481         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2482         uint64_t ret_ref = 0;
2483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2485         return ret_ref;
2486 }
2487
2488 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2489         LDKBlindedPath ret = owner->b;
2490         ret.is_owned = false;
2491         return ret;
2492 }
2493 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2494         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2495         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2496         uint64_t ret_ref = 0;
2497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2499         return ret_ref;
2500 }
2501
2502 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2503         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2504         for (size_t i = 0; i < ret.datalen; i++) {
2505                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2506         }
2507         return ret;
2508 }
2509 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2510         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2511         for (size_t i = 0; i < ret.datalen; i++) {
2512                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2513         }
2514         return ret;
2515 }
2516 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2517         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2518         for (size_t i = 0; i < ret.datalen; i++) {
2519                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2520         }
2521         return ret;
2522 }
2523 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2524         LDKRouteHint ret = *owner->contents.result;
2525         ret.is_owned = false;
2526         return ret;
2527 }
2528 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2529         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2530         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2531         uint64_t ret_ref = 0;
2532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2534         return ret_ref;
2535 }
2536
2537 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2538 CHECK(!owner->result_ok);
2539         return DecodeError_clone(&*owner->contents.err);
2540 }
2541 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2542         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2543         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2544         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2545         uint64_t ret_ref = tag_ptr(ret_copy, true);
2546         return ret_ref;
2547 }
2548
2549 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2550         LDKRouteHintHop ret = *owner->contents.result;
2551         ret.is_owned = false;
2552         return ret;
2553 }
2554 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2555         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2556         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2557         uint64_t ret_ref = 0;
2558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2560         return ret_ref;
2561 }
2562
2563 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2564 CHECK(!owner->result_ok);
2565         return DecodeError_clone(&*owner->contents.err);
2566 }
2567 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2568         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2569         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2570         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2571         uint64_t ret_ref = tag_ptr(ret_copy, true);
2572         return ret_ref;
2573 }
2574
2575 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2576         LDKFixedPenaltyScorer ret = *owner->contents.result;
2577         ret.is_owned = false;
2578         return ret;
2579 }
2580 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2581         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2582         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2583         uint64_t ret_ref = 0;
2584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2586         return ret_ref;
2587 }
2588
2589 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2590 CHECK(!owner->result_ok);
2591         return DecodeError_clone(&*owner->contents.err);
2592 }
2593 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2594         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2595         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2596         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2597         uint64_t ret_ref = tag_ptr(ret_copy, true);
2598         return ret_ref;
2599 }
2600
2601 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2602         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2603         for (size_t i = 0; i < ret.datalen; i++) {
2604                 ret.data[i] = NodeId_clone(&orig->data[i]);
2605         }
2606         return ret;
2607 }
2608 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2609         return owner->a;
2610 }
2611 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2612         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2613         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2614         return ret_conv;
2615 }
2616
2617 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2618         return owner->b;
2619 }
2620 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2621         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2622         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2623         return ret_conv;
2624 }
2625
2626 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2627         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2628         switch(obj->tag) {
2629                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2630                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2631                 default: abort();
2632         }
2633 }
2634 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2635         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2636         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2637                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2638                         *some_conv = obj->some;
2639                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2640         return tag_ptr(some_conv, true);
2641 }
2642 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2643         return owner->a;
2644 }
2645 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2646         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2647         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2648         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
2649         return ret_arr;
2650 }
2651
2652 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2653         return owner->b;
2654 }
2655 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2656         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2657         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2658         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
2659         return ret_arr;
2660 }
2661
2662 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2663         return owner->a;
2664 }
2665 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
2666         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2667         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2668         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
2669         return ret_arr;
2670 }
2671
2672 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2673         return owner->b;
2674 }
2675 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
2676         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2677         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2678         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
2679         return ret_arr;
2680 }
2681
2682 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
2683         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2684         switch(obj->tag) {
2685                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
2686                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
2687                 default: abort();
2688         }
2689 }
2690 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
2691         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2692         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
2693                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
2694                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
2695         return tag_ptr(some_conv, false);
2696 }
2697 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
2698         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2699         switch(obj->tag) {
2700                 case LDKCOption_f64Z_Some: return 0;
2701                 case LDKCOption_f64Z_None: return 1;
2702                 default: abort();
2703         }
2704 }
2705 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
2706         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2707         assert(obj->tag == LDKCOption_f64Z_Some);
2708                         double some_conv = obj->some;
2709         return some_conv;
2710 }
2711 typedef struct LDKLogger_JCalls {
2712         atomic_size_t refcnt;
2713         uint32_t instance_ptr;
2714 } LDKLogger_JCalls;
2715 static void LDKLogger_JCalls_free(void* this_arg) {
2716         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2717         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2718                 FREE(j_calls);
2719         }
2720 }
2721 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2722         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2723         LDKRecord record_var = *record;
2724         uint64_t record_ref = 0;
2725         record_var = Record_clone(&record_var);
2726         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2727         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2728         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
2729 }
2730 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2731         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2732         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2733 }
2734 static inline LDKLogger LDKLogger_init (JSValue o) {
2735         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2736         atomic_init(&calls->refcnt, 1);
2737         calls->instance_ptr = o;
2738
2739         LDKLogger ret = {
2740                 .this_arg = (void*) calls,
2741                 .log = log_LDKLogger_jcall,
2742                 .free = LDKLogger_JCalls_free,
2743         };
2744         return ret;
2745 }
2746 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2747         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2748         *res_ptr = LDKLogger_init(o);
2749         return tag_ptr(res_ptr, true);
2750 }
2751 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2752         LDKProbabilisticScorer ret = *owner->contents.result;
2753         ret.is_owned = false;
2754         return ret;
2755 }
2756 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2757         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2758         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2759         uint64_t ret_ref = 0;
2760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2762         return ret_ref;
2763 }
2764
2765 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2766 CHECK(!owner->result_ok);
2767         return DecodeError_clone(&*owner->contents.err);
2768 }
2769 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2770         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2771         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2772         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2773         uint64_t ret_ref = tag_ptr(ret_copy, true);
2774         return ret_ref;
2775 }
2776
2777 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2778         return owner->a;
2779 }
2780 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2781         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2782         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2783         return ret_conv;
2784 }
2785
2786 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2787         return owner->b;
2788 }
2789 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2790         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2791         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2792         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2793         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2794         return ret_arr;
2795 }
2796
2797 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2798         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2799         for (size_t i = 0; i < ret.datalen; i++) {
2800                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2801         }
2802         return ret;
2803 }
2804 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2805         return ThirtyTwoBytes_clone(&owner->a);
2806 }
2807 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
2808         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2809         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2810         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
2811         return ret_arr;
2812 }
2813
2814 static inline struct LDKCOption_ThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2815         return COption_ThirtyTwoBytesZ_clone(&owner->b);
2816 }
2817 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
2818         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2819         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
2820         *ret_copy = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(owner_conv);
2821         uint64_t ret_ref = tag_ptr(ret_copy, true);
2822         return ret_ref;
2823 }
2824
2825 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ *orig) {
2826         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
2827         for (size_t i = 0; i < ret.datalen; i++) {
2828                 ret.data[i] = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
2829         }
2830         return ret;
2831 }
2832 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2833 CHECK(owner->result_ok);
2834         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
2835 }
2836 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
2837         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2838         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
2839         return ret_conv;
2840 }
2841
2842 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2843 CHECK(!owner->result_ok);
2844         return *owner->contents.err;
2845 }
2846 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
2847         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2848         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
2849 }
2850
2851 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2852         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2853         switch(obj->tag) {
2854                 case LDKMonitorEvent_HTLCEvent: return 0;
2855                 case LDKMonitorEvent_HolderForceClosed: return 1;
2856                 case LDKMonitorEvent_Completed: return 2;
2857                 default: abort();
2858         }
2859 }
2860 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2861         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2862         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2863                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2864                         uint64_t htlc_event_ref = 0;
2865                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2866                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2867         return htlc_event_ref;
2868 }
2869 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
2870         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2871         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
2872                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
2873                         uint64_t holder_force_closed_ref = 0;
2874                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
2875                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
2876         return holder_force_closed_ref;
2877 }
2878 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2879         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2880         assert(obj->tag == LDKMonitorEvent_Completed);
2881                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2882                         uint64_t funding_txo_ref = 0;
2883                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2884                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2885         return funding_txo_ref;
2886 }
2887 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2888         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2889         assert(obj->tag == LDKMonitorEvent_Completed);
2890                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2891         return monitor_update_id_conv;
2892 }
2893 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2894         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2895         for (size_t i = 0; i < ret.datalen; i++) {
2896                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2897         }
2898         return ret;
2899 }
2900 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2901         LDKOutPoint ret = owner->a;
2902         ret.is_owned = false;
2903         return ret;
2904 }
2905 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2906         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2907         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2908         uint64_t ret_ref = 0;
2909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2911         return ret_ref;
2912 }
2913
2914 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2915         return CVec_MonitorEventZ_clone(&owner->b);
2916 }
2917 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2918         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2919         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2920         uint64_tArray ret_arr = NULL;
2921         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2922         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2923         for (size_t o = 0; o < ret_var.datalen; o++) {
2924                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2925                 *ret_conv_14_copy = ret_var.data[o];
2926                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2927                 ret_arr_ptr[o] = ret_conv_14_ref;
2928         }
2929         
2930         FREE(ret_var.data);
2931         return ret_arr;
2932 }
2933
2934 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2935         return owner->c;
2936 }
2937 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2938         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2939         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2940         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2941         return ret_arr;
2942 }
2943
2944 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2945         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2946         for (size_t i = 0; i < ret.datalen; i++) {
2947                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2948         }
2949         return ret;
2950 }
2951 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2952         LDKInitFeatures ret = *owner->contents.result;
2953         ret.is_owned = false;
2954         return ret;
2955 }
2956 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2957         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2958         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2959         uint64_t ret_ref = 0;
2960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2962         return ret_ref;
2963 }
2964
2965 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2966 CHECK(!owner->result_ok);
2967         return DecodeError_clone(&*owner->contents.err);
2968 }
2969 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2970         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2971         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2972         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2973         uint64_t ret_ref = tag_ptr(ret_copy, true);
2974         return ret_ref;
2975 }
2976
2977 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2978         LDKChannelFeatures ret = *owner->contents.result;
2979         ret.is_owned = false;
2980         return ret;
2981 }
2982 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2983         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2984         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2985         uint64_t ret_ref = 0;
2986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2988         return ret_ref;
2989 }
2990
2991 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2992 CHECK(!owner->result_ok);
2993         return DecodeError_clone(&*owner->contents.err);
2994 }
2995 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2996         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2997         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2998         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2999         uint64_t ret_ref = tag_ptr(ret_copy, true);
3000         return ret_ref;
3001 }
3002
3003 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3004         LDKNodeFeatures ret = *owner->contents.result;
3005         ret.is_owned = false;
3006         return ret;
3007 }
3008 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3009         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3010         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3011         uint64_t ret_ref = 0;
3012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3014         return ret_ref;
3015 }
3016
3017 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3018 CHECK(!owner->result_ok);
3019         return DecodeError_clone(&*owner->contents.err);
3020 }
3021 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3022         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3023         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3024         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3025         uint64_t ret_ref = tag_ptr(ret_copy, true);
3026         return ret_ref;
3027 }
3028
3029 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3030         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3031         ret.is_owned = false;
3032         return ret;
3033 }
3034 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3035         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3036         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3037         uint64_t ret_ref = 0;
3038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3040         return ret_ref;
3041 }
3042
3043 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3044 CHECK(!owner->result_ok);
3045         return DecodeError_clone(&*owner->contents.err);
3046 }
3047 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3048         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3049         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3050         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3051         uint64_t ret_ref = tag_ptr(ret_copy, true);
3052         return ret_ref;
3053 }
3054
3055 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3056         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3057         ret.is_owned = false;
3058         return ret;
3059 }
3060 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3061         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3062         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3063         uint64_t ret_ref = 0;
3064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3066         return ret_ref;
3067 }
3068
3069 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3070 CHECK(!owner->result_ok);
3071         return DecodeError_clone(&*owner->contents.err);
3072 }
3073 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3074         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3075         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3076         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3077         uint64_t ret_ref = tag_ptr(ret_copy, true);
3078         return ret_ref;
3079 }
3080
3081 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3082         LDKBlindedHopFeatures ret = *owner->contents.result;
3083         ret.is_owned = false;
3084         return ret;
3085 }
3086 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3087         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3088         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3089         uint64_t ret_ref = 0;
3090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3092         return ret_ref;
3093 }
3094
3095 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3096 CHECK(!owner->result_ok);
3097         return DecodeError_clone(&*owner->contents.err);
3098 }
3099 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3100         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3101         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3102         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3103         uint64_t ret_ref = tag_ptr(ret_copy, true);
3104         return ret_ref;
3105 }
3106
3107 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3108         LDKChannelTypeFeatures ret = *owner->contents.result;
3109         ret.is_owned = false;
3110         return ret;
3111 }
3112 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3113         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3114         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3115         uint64_t ret_ref = 0;
3116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3118         return ret_ref;
3119 }
3120
3121 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3122 CHECK(!owner->result_ok);
3123         return DecodeError_clone(&*owner->contents.err);
3124 }
3125 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3126         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3127         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3128         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3129         uint64_t ret_ref = tag_ptr(ret_copy, true);
3130         return ret_ref;
3131 }
3132
3133 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3134         LDKOffer ret = *owner->contents.result;
3135         ret.is_owned = false;
3136         return ret;
3137 }
3138 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3139         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3140         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3141         uint64_t ret_ref = 0;
3142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3144         return ret_ref;
3145 }
3146
3147 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3148         LDKBolt12ParseError ret = *owner->contents.err;
3149         ret.is_owned = false;
3150         return ret;
3151 }
3152 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3153         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3154         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3155         uint64_t ret_ref = 0;
3156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3158         return ret_ref;
3159 }
3160
3161 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3162 CHECK(owner->result_ok);
3163         return *owner->contents.result;
3164 }
3165 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3166         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3167         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3168         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3169         return ret_arr;
3170 }
3171
3172 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3173 CHECK(!owner->result_ok);
3174         return *owner->contents.err;
3175 }
3176 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3177         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3178         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3179         return ret_conv;
3180 }
3181
3182 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3183         LDKNodeId ret = *owner->contents.result;
3184         ret.is_owned = false;
3185         return ret;
3186 }
3187 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3188         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3189         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3190         uint64_t ret_ref = 0;
3191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3193         return ret_ref;
3194 }
3195
3196 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3197 CHECK(!owner->result_ok);
3198         return DecodeError_clone(&*owner->contents.err);
3199 }
3200 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3201         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3202         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3203         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3204         uint64_t ret_ref = tag_ptr(ret_copy, true);
3205         return ret_ref;
3206 }
3207
3208 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3209         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3210         switch(obj->tag) {
3211                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3212                 case LDKNetworkUpdate_ChannelFailure: return 1;
3213                 case LDKNetworkUpdate_NodeFailure: return 2;
3214                 default: abort();
3215         }
3216 }
3217 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3218         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3219         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3220                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3221                         uint64_t msg_ref = 0;
3222                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3223                         msg_ref = tag_ptr(msg_var.inner, false);
3224         return msg_ref;
3225 }
3226 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3227         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3228         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3229                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3230         return short_channel_id_conv;
3231 }
3232 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3233         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3234         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3235                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3236         return is_permanent_conv;
3237 }
3238 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3239         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3240         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3241                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3242                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3243         return node_id_arr;
3244 }
3245 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3246         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3247         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3248                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3249         return is_permanent_conv;
3250 }
3251 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3252         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3253         switch(obj->tag) {
3254                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3255                 case LDKCOption_NetworkUpdateZ_None: return 1;
3256                 default: abort();
3257         }
3258 }
3259 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3260         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3261         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3262                         uint64_t some_ref = tag_ptr(&obj->some, false);
3263         return some_ref;
3264 }
3265 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3266 CHECK(owner->result_ok);
3267         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3268 }
3269 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3270         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3271         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3272         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3273         uint64_t ret_ref = tag_ptr(ret_copy, true);
3274         return ret_ref;
3275 }
3276
3277 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3278 CHECK(!owner->result_ok);
3279         return DecodeError_clone(&*owner->contents.err);
3280 }
3281 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3282         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3283         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3284         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3285         uint64_t ret_ref = tag_ptr(ret_copy, true);
3286         return ret_ref;
3287 }
3288
3289 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3290 CHECK(owner->result_ok);
3291         return TxOut_clone(&*owner->contents.result);
3292 }
3293 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3294         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3295         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3296         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3297         return tag_ptr(ret_ref, true);
3298 }
3299
3300 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3301 CHECK(!owner->result_ok);
3302         return UtxoLookupError_clone(&*owner->contents.err);
3303 }
3304 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3305         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3306         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3307         return ret_conv;
3308 }
3309
3310 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3311         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3312         switch(obj->tag) {
3313                 case LDKUtxoResult_Sync: return 0;
3314                 case LDKUtxoResult_Async: return 1;
3315                 default: abort();
3316         }
3317 }
3318 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3319         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3320         assert(obj->tag == LDKUtxoResult_Sync);
3321                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3322                         *sync_conv = obj->sync;
3323                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3324         return tag_ptr(sync_conv, true);
3325 }
3326 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3327         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3328         assert(obj->tag == LDKUtxoResult_Async);
3329                         LDKUtxoFuture async_var = obj->async;
3330                         uint64_t async_ref = 0;
3331                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3332                         async_ref = tag_ptr(async_var.inner, false);
3333         return async_ref;
3334 }
3335 typedef struct LDKUtxoLookup_JCalls {
3336         atomic_size_t refcnt;
3337         uint32_t instance_ptr;
3338 } LDKUtxoLookup_JCalls;
3339 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3340         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3341         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3342                 FREE(j_calls);
3343         }
3344 }
3345 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3346         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3347         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3348         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3349         int64_t short_channel_id_conv = short_channel_id;
3350         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);
3351         void* ret_ptr = untag_ptr(ret);
3352         CHECK_ACCESS(ret_ptr);
3353         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3354         FREE(untag_ptr(ret));
3355         return ret_conv;
3356 }
3357 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3358         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3359         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3360 }
3361 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3362         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3363         atomic_init(&calls->refcnt, 1);
3364         calls->instance_ptr = o;
3365
3366         LDKUtxoLookup ret = {
3367                 .this_arg = (void*) calls,
3368                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3369                 .free = LDKUtxoLookup_JCalls_free,
3370         };
3371         return ret;
3372 }
3373 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3374         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3375         *res_ptr = LDKUtxoLookup_init(o);
3376         return tag_ptr(res_ptr, true);
3377 }
3378 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) {
3379         void* this_arg_ptr = untag_ptr(this_arg);
3380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3381         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3382         uint8_t genesis_hash_arr[32];
3383         CHECK(genesis_hash->arr_len == 32);
3384         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3385         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
3386         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3387         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3388         uint64_t ret_ref = tag_ptr(ret_copy, true);
3389         return ret_ref;
3390 }
3391
3392 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3393         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3394         switch(obj->tag) {
3395                 case LDKCOption_UtxoLookupZ_Some: return 0;
3396                 case LDKCOption_UtxoLookupZ_None: return 1;
3397                 default: abort();
3398         }
3399 }
3400 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3401         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3402         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3403                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3404                         *some_ret = obj->some;
3405                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3406                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3407                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3408                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3409                         }
3410         return tag_ptr(some_ret, true);
3411 }
3412 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3413 CHECK(owner->result_ok);
3414         return *owner->contents.result;
3415 }
3416 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3417         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3418         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3419 }
3420
3421 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3422         LDKLightningError ret = *owner->contents.err;
3423         ret.is_owned = false;
3424         return ret;
3425 }
3426 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3427         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3428         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3429         uint64_t ret_ref = 0;
3430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3432         return ret_ref;
3433 }
3434
3435 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3436 CHECK(owner->result_ok);
3437         return *owner->contents.result;
3438 }
3439 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3440         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3441         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3442         return ret_conv;
3443 }
3444
3445 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3446         LDKLightningError ret = *owner->contents.err;
3447         ret.is_owned = false;
3448         return ret;
3449 }
3450 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3451         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3452         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3453         uint64_t ret_ref = 0;
3454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3456         return ret_ref;
3457 }
3458
3459 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3460         LDKChannelAnnouncement ret = owner->a;
3461         ret.is_owned = false;
3462         return ret;
3463 }
3464 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3465         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3466         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3467         uint64_t ret_ref = 0;
3468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3470         return ret_ref;
3471 }
3472
3473 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3474         LDKChannelUpdate ret = owner->b;
3475         ret.is_owned = false;
3476         return ret;
3477 }
3478 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3479         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3480         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3481         uint64_t ret_ref = 0;
3482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3484         return ret_ref;
3485 }
3486
3487 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3488         LDKChannelUpdate ret = owner->c;
3489         ret.is_owned = false;
3490         return ret;
3491 }
3492 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3493         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3494         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3495         uint64_t ret_ref = 0;
3496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3498         return ret_ref;
3499 }
3500
3501 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3502         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3503         switch(obj->tag) {
3504                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3505                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3506                 default: abort();
3507         }
3508 }
3509 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3510         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3511         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3512                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3513                         *some_conv = obj->some;
3514                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3515         return tag_ptr(some_conv, true);
3516 }
3517 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
3518         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3519         switch(obj->tag) {
3520                 case LDKErrorAction_DisconnectPeer: return 0;
3521                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
3522                 case LDKErrorAction_IgnoreError: return 2;
3523                 case LDKErrorAction_IgnoreAndLog: return 3;
3524                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
3525                 case LDKErrorAction_SendErrorMessage: return 5;
3526                 case LDKErrorAction_SendWarningMessage: return 6;
3527                 default: abort();
3528         }
3529 }
3530 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
3531         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3532         assert(obj->tag == LDKErrorAction_DisconnectPeer);
3533                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3534                         uint64_t msg_ref = 0;
3535                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3536                         msg_ref = tag_ptr(msg_var.inner, false);
3537         return msg_ref;
3538 }
3539 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
3540         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3541         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
3542                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
3543                         uint64_t msg_ref = 0;
3544                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3545                         msg_ref = tag_ptr(msg_var.inner, false);
3546         return msg_ref;
3547 }
3548 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
3549         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3550         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
3551                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
3552         return ignore_and_log_conv;
3553 }
3554 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
3555         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3556         assert(obj->tag == LDKErrorAction_SendErrorMessage);
3557                         LDKErrorMessage msg_var = obj->send_error_message.msg;
3558                         uint64_t msg_ref = 0;
3559                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3560                         msg_ref = tag_ptr(msg_var.inner, false);
3561         return msg_ref;
3562 }
3563 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
3564         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3565         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3566                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3567                         uint64_t msg_ref = 0;
3568                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3569                         msg_ref = tag_ptr(msg_var.inner, false);
3570         return msg_ref;
3571 }
3572 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
3573         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3574         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3575                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
3576         return log_level_conv;
3577 }
3578 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
3579         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3580         switch(obj->tag) {
3581                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
3582                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
3583                 case LDKMessageSendEvent_SendOpenChannel: return 2;
3584                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
3585                 case LDKMessageSendEvent_SendFundingCreated: return 4;
3586                 case LDKMessageSendEvent_SendFundingSigned: return 5;
3587                 case LDKMessageSendEvent_SendTxAddInput: return 6;
3588                 case LDKMessageSendEvent_SendTxAddOutput: return 7;
3589                 case LDKMessageSendEvent_SendTxRemoveInput: return 8;
3590                 case LDKMessageSendEvent_SendTxRemoveOutput: return 9;
3591                 case LDKMessageSendEvent_SendTxComplete: return 10;
3592                 case LDKMessageSendEvent_SendTxSignatures: return 11;
3593                 case LDKMessageSendEvent_SendTxInitRbf: return 12;
3594                 case LDKMessageSendEvent_SendTxAckRbf: return 13;
3595                 case LDKMessageSendEvent_SendTxAbort: return 14;
3596                 case LDKMessageSendEvent_SendChannelReady: return 15;
3597                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 16;
3598                 case LDKMessageSendEvent_UpdateHTLCs: return 17;
3599                 case LDKMessageSendEvent_SendRevokeAndACK: return 18;
3600                 case LDKMessageSendEvent_SendClosingSigned: return 19;
3601                 case LDKMessageSendEvent_SendShutdown: return 20;
3602                 case LDKMessageSendEvent_SendChannelReestablish: return 21;
3603                 case LDKMessageSendEvent_SendChannelAnnouncement: return 22;
3604                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 23;
3605                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 24;
3606                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 25;
3607                 case LDKMessageSendEvent_SendChannelUpdate: return 26;
3608                 case LDKMessageSendEvent_HandleError: return 27;
3609                 case LDKMessageSendEvent_SendChannelRangeQuery: return 28;
3610                 case LDKMessageSendEvent_SendShortIdsQuery: return 29;
3611                 case LDKMessageSendEvent_SendReplyChannelRange: return 30;
3612                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 31;
3613                 default: abort();
3614         }
3615 }
3616 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
3617         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3618         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3619                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3620                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
3621         return node_id_arr;
3622 }
3623 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
3624         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3625         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3626                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3627                         uint64_t msg_ref = 0;
3628                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3629                         msg_ref = tag_ptr(msg_var.inner, false);
3630         return msg_ref;
3631 }
3632 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
3633         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3634         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3635                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3636                         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
3637         return node_id_arr;
3638 }
3639 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
3640         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3641         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3642                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
3643                         uint64_t msg_ref = 0;
3644                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3645                         msg_ref = tag_ptr(msg_var.inner, false);
3646         return msg_ref;
3647 }
3648 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
3649         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3650         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3651                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3652                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
3653         return node_id_arr;
3654 }
3655 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
3656         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3657         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3658                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3659                         uint64_t msg_ref = 0;
3660                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3661                         msg_ref = tag_ptr(msg_var.inner, false);
3662         return msg_ref;
3663 }
3664 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
3665         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3666         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3667                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3668                         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
3669         return node_id_arr;
3670 }
3671 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
3672         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3673         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3674                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
3675                         uint64_t msg_ref = 0;
3676                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3677                         msg_ref = tag_ptr(msg_var.inner, false);
3678         return msg_ref;
3679 }
3680 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
3681         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3682         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3683                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3684                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
3685         return node_id_arr;
3686 }
3687 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
3688         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3689         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3690                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3691                         uint64_t msg_ref = 0;
3692                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3693                         msg_ref = tag_ptr(msg_var.inner, false);
3694         return msg_ref;
3695 }
3696 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
3697         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3698         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3699                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3700                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
3701         return node_id_arr;
3702 }
3703 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
3704         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3705         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3706                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3707                         uint64_t msg_ref = 0;
3708                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3709                         msg_ref = tag_ptr(msg_var.inner, false);
3710         return msg_ref;
3711 }
3712 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
3713         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3714         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3715                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3716                         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
3717         return node_id_arr;
3718 }
3719 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
3720         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3721         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3722                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
3723                         uint64_t msg_ref = 0;
3724                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3725                         msg_ref = tag_ptr(msg_var.inner, false);
3726         return msg_ref;
3727 }
3728 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
3729         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3730         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3731                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3732                         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
3733         return node_id_arr;
3734 }
3735 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
3736         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3737         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3738                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
3739                         uint64_t msg_ref = 0;
3740                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3741                         msg_ref = tag_ptr(msg_var.inner, false);
3742         return msg_ref;
3743 }
3744 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
3745         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3746         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3747                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3748                         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
3749         return node_id_arr;
3750 }
3751 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
3752         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3753         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3754                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
3755                         uint64_t msg_ref = 0;
3756                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3757                         msg_ref = tag_ptr(msg_var.inner, false);
3758         return msg_ref;
3759 }
3760 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
3761         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3762         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3763                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3764                         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
3765         return node_id_arr;
3766 }
3767 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
3768         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3769         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3770                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
3771                         uint64_t msg_ref = 0;
3772                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3773                         msg_ref = tag_ptr(msg_var.inner, false);
3774         return msg_ref;
3775 }
3776 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
3777         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3778         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3779                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3780                         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
3781         return node_id_arr;
3782 }
3783 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
3784         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3785         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3786                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
3787                         uint64_t msg_ref = 0;
3788                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3789                         msg_ref = tag_ptr(msg_var.inner, false);
3790         return msg_ref;
3791 }
3792 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
3793         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3794         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3795                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3796                         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
3797         return node_id_arr;
3798 }
3799 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
3800         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3801         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3802                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
3803                         uint64_t msg_ref = 0;
3804                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3805                         msg_ref = tag_ptr(msg_var.inner, false);
3806         return msg_ref;
3807 }
3808 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
3809         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3810         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
3811                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3812                         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
3813         return node_id_arr;
3814 }
3815 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
3816         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3817         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
3818                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
3819                         uint64_t msg_ref = 0;
3820                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3821                         msg_ref = tag_ptr(msg_var.inner, false);
3822         return msg_ref;
3823 }
3824 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
3825         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3826         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
3827                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3828                         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
3829         return node_id_arr;
3830 }
3831 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
3832         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3833         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
3834                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
3835                         uint64_t msg_ref = 0;
3836                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3837                         msg_ref = tag_ptr(msg_var.inner, false);
3838         return msg_ref;
3839 }
3840 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
3841         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3842         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
3843                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3844                         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
3845         return node_id_arr;
3846 }
3847 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
3848         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3849         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
3850                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
3851                         uint64_t msg_ref = 0;
3852                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3853                         msg_ref = tag_ptr(msg_var.inner, false);
3854         return msg_ref;
3855 }
3856 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
3857         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3858         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3859                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3860                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
3861         return node_id_arr;
3862 }
3863 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
3864         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3865         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3866                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
3867                         uint64_t msg_ref = 0;
3868                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3869                         msg_ref = tag_ptr(msg_var.inner, false);
3870         return msg_ref;
3871 }
3872 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
3873         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3874         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3875                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3876                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
3877         return node_id_arr;
3878 }
3879 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
3880         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3881         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3882                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3883                         uint64_t msg_ref = 0;
3884                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3885                         msg_ref = tag_ptr(msg_var.inner, false);
3886         return msg_ref;
3887 }
3888 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
3889         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3890         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3891                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3892                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
3893         return node_id_arr;
3894 }
3895 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
3896         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3897         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3898                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3899                         uint64_t updates_ref = 0;
3900                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3901                         updates_ref = tag_ptr(updates_var.inner, false);
3902         return updates_ref;
3903 }
3904 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
3905         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3906         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3907                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3908                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
3909         return node_id_arr;
3910 }
3911 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
3912         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3913         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3914                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3915                         uint64_t msg_ref = 0;
3916                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3917                         msg_ref = tag_ptr(msg_var.inner, false);
3918         return msg_ref;
3919 }
3920 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
3921         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3922         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3923                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3924                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
3925         return node_id_arr;
3926 }
3927 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
3928         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3929         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3930                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3931                         uint64_t msg_ref = 0;
3932                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3933                         msg_ref = tag_ptr(msg_var.inner, false);
3934         return msg_ref;
3935 }
3936 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
3937         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3938         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3939                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3940                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
3941         return node_id_arr;
3942 }
3943 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
3944         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3945         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3946                         LDKShutdown msg_var = obj->send_shutdown.msg;
3947                         uint64_t msg_ref = 0;
3948                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3949                         msg_ref = tag_ptr(msg_var.inner, false);
3950         return msg_ref;
3951 }
3952 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
3953         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3954         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3955                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3956                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
3957         return node_id_arr;
3958 }
3959 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
3960         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3961         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3962                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3963                         uint64_t msg_ref = 0;
3964                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3965                         msg_ref = tag_ptr(msg_var.inner, false);
3966         return msg_ref;
3967 }
3968 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
3969         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3970         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3971                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3972                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
3973         return node_id_arr;
3974 }
3975 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
3976         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3977         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3978                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
3979                         uint64_t msg_ref = 0;
3980                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3981                         msg_ref = tag_ptr(msg_var.inner, false);
3982         return msg_ref;
3983 }
3984 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
3985         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3986         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3987                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
3988                         uint64_t update_msg_ref = 0;
3989                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3990                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
3991         return update_msg_ref;
3992 }
3993 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
3994         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3995         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3996                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3997                         uint64_t msg_ref = 0;
3998                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3999                         msg_ref = tag_ptr(msg_var.inner, false);
4000         return msg_ref;
4001 }
4002 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4003         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4004         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4005                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4006                         uint64_t update_msg_ref = 0;
4007                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4008                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4009         return update_msg_ref;
4010 }
4011 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4012         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4013         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4014                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4015                         uint64_t msg_ref = 0;
4016                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4017                         msg_ref = tag_ptr(msg_var.inner, false);
4018         return msg_ref;
4019 }
4020 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4021         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4022         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4023                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4024                         uint64_t msg_ref = 0;
4025                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4026                         msg_ref = tag_ptr(msg_var.inner, false);
4027         return msg_ref;
4028 }
4029 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4030         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4031         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4032                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4033                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4034         return node_id_arr;
4035 }
4036 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4037         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4038         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4039                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4040                         uint64_t msg_ref = 0;
4041                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4042                         msg_ref = tag_ptr(msg_var.inner, false);
4043         return msg_ref;
4044 }
4045 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4046         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4047         assert(obj->tag == LDKMessageSendEvent_HandleError);
4048                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4049                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4050         return node_id_arr;
4051 }
4052 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4053         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4054         assert(obj->tag == LDKMessageSendEvent_HandleError);
4055                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4056         return action_ref;
4057 }
4058 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4059         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4060         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4061                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4062                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4063         return node_id_arr;
4064 }
4065 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4066         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4067         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4068                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4069                         uint64_t msg_ref = 0;
4070                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4071                         msg_ref = tag_ptr(msg_var.inner, false);
4072         return msg_ref;
4073 }
4074 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4075         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4076         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4077                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4078                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4079         return node_id_arr;
4080 }
4081 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4082         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4083         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4084                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4085                         uint64_t msg_ref = 0;
4086                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4087                         msg_ref = tag_ptr(msg_var.inner, false);
4088         return msg_ref;
4089 }
4090 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4091         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4092         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4093                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4094                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4095         return node_id_arr;
4096 }
4097 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4098         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4099         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4100                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4101                         uint64_t msg_ref = 0;
4102                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4103                         msg_ref = tag_ptr(msg_var.inner, false);
4104         return msg_ref;
4105 }
4106 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4107         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4108         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4109                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4110                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4111         return node_id_arr;
4112 }
4113 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4114         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4115         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4116                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4117                         uint64_t msg_ref = 0;
4118                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4119                         msg_ref = tag_ptr(msg_var.inner, false);
4120         return msg_ref;
4121 }
4122 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4123         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4124         for (size_t i = 0; i < ret.datalen; i++) {
4125                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4126         }
4127         return ret;
4128 }
4129 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4130         LDKChannelUpdateInfo ret = *owner->contents.result;
4131         ret.is_owned = false;
4132         return ret;
4133 }
4134 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4135         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4136         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4137         uint64_t ret_ref = 0;
4138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4140         return ret_ref;
4141 }
4142
4143 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4144 CHECK(!owner->result_ok);
4145         return DecodeError_clone(&*owner->contents.err);
4146 }
4147 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4148         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4149         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4150         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4151         uint64_t ret_ref = tag_ptr(ret_copy, true);
4152         return ret_ref;
4153 }
4154
4155 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4156         LDKChannelInfo ret = *owner->contents.result;
4157         ret.is_owned = false;
4158         return ret;
4159 }
4160 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4161         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4162         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4163         uint64_t ret_ref = 0;
4164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4166         return ret_ref;
4167 }
4168
4169 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4170 CHECK(!owner->result_ok);
4171         return DecodeError_clone(&*owner->contents.err);
4172 }
4173 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4174         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4175         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4176         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4177         uint64_t ret_ref = tag_ptr(ret_copy, true);
4178         return ret_ref;
4179 }
4180
4181 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4182         LDKRoutingFees ret = *owner->contents.result;
4183         ret.is_owned = false;
4184         return ret;
4185 }
4186 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4187         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4188         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4189         uint64_t ret_ref = 0;
4190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4192         return ret_ref;
4193 }
4194
4195 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4196 CHECK(!owner->result_ok);
4197         return DecodeError_clone(&*owner->contents.err);
4198 }
4199 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4200         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4201         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4202         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4203         uint64_t ret_ref = tag_ptr(ret_copy, true);
4204         return ret_ref;
4205 }
4206
4207 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4208         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4209         switch(obj->tag) {
4210                 case LDKSocketAddress_TcpIpV4: return 0;
4211                 case LDKSocketAddress_TcpIpV6: return 1;
4212                 case LDKSocketAddress_OnionV2: return 2;
4213                 case LDKSocketAddress_OnionV3: return 3;
4214                 case LDKSocketAddress_Hostname: return 4;
4215                 default: abort();
4216         }
4217 }
4218 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4219         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4220         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4221                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4222                         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4223         return addr_arr;
4224 }
4225 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4226         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4227         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4228                         int16_t port_conv = obj->tcp_ip_v4.port;
4229         return port_conv;
4230 }
4231 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4232         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4233         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4234                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4235                         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4236         return addr_arr;
4237 }
4238 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4239         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4240         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4241                         int16_t port_conv = obj->tcp_ip_v6.port;
4242         return port_conv;
4243 }
4244 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4245         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4246         assert(obj->tag == LDKSocketAddress_OnionV2);
4247                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4248                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4249         return onion_v2_arr;
4250 }
4251 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4252         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4253         assert(obj->tag == LDKSocketAddress_OnionV3);
4254                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4255                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4256         return ed25519_pubkey_arr;
4257 }
4258 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4259         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4260         assert(obj->tag == LDKSocketAddress_OnionV3);
4261                         int16_t checksum_conv = obj->onion_v3.checksum;
4262         return checksum_conv;
4263 }
4264 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4265         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4266         assert(obj->tag == LDKSocketAddress_OnionV3);
4267                         int8_t version_conv = obj->onion_v3.version;
4268         return version_conv;
4269 }
4270 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4271         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4272         assert(obj->tag == LDKSocketAddress_OnionV3);
4273                         int16_t port_conv = obj->onion_v3.port;
4274         return port_conv;
4275 }
4276 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4277         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4278         assert(obj->tag == LDKSocketAddress_Hostname);
4279                         LDKHostname hostname_var = obj->hostname.hostname;
4280                         uint64_t hostname_ref = 0;
4281                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4282                         hostname_ref = tag_ptr(hostname_var.inner, false);
4283         return hostname_ref;
4284 }
4285 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4286         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4287         assert(obj->tag == LDKSocketAddress_Hostname);
4288                         int16_t port_conv = obj->hostname.port;
4289         return port_conv;
4290 }
4291 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4292         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4293         for (size_t i = 0; i < ret.datalen; i++) {
4294                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4295         }
4296         return ret;
4297 }
4298 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4299         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4300         ret.is_owned = false;
4301         return ret;
4302 }
4303 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4304         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4305         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4306         uint64_t ret_ref = 0;
4307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4309         return ret_ref;
4310 }
4311
4312 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4313 CHECK(!owner->result_ok);
4314         return DecodeError_clone(&*owner->contents.err);
4315 }
4316 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4317         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4318         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4319         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4320         uint64_t ret_ref = tag_ptr(ret_copy, true);
4321         return ret_ref;
4322 }
4323
4324 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4325         LDKNodeAlias ret = *owner->contents.result;
4326         ret.is_owned = false;
4327         return ret;
4328 }
4329 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4330         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4331         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4332         uint64_t ret_ref = 0;
4333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4335         return ret_ref;
4336 }
4337
4338 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4339 CHECK(!owner->result_ok);
4340         return DecodeError_clone(&*owner->contents.err);
4341 }
4342 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
4343         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4344         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4345         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4346         uint64_t ret_ref = tag_ptr(ret_copy, true);
4347         return ret_ref;
4348 }
4349
4350 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4351         LDKNodeInfo ret = *owner->contents.result;
4352         ret.is_owned = false;
4353         return ret;
4354 }
4355 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
4356         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4357         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4358         uint64_t ret_ref = 0;
4359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4361         return ret_ref;
4362 }
4363
4364 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4365 CHECK(!owner->result_ok);
4366         return DecodeError_clone(&*owner->contents.err);
4367 }
4368 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
4369         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4370         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4371         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4372         uint64_t ret_ref = tag_ptr(ret_copy, true);
4373         return ret_ref;
4374 }
4375
4376 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4377         LDKNetworkGraph ret = *owner->contents.result;
4378         ret.is_owned = false;
4379         return ret;
4380 }
4381 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
4382         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4383         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4384         uint64_t ret_ref = 0;
4385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4387         return ret_ref;
4388 }
4389
4390 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4391 CHECK(!owner->result_ok);
4392         return DecodeError_clone(&*owner->contents.err);
4393 }
4394 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
4395         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4396         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4397         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4398         uint64_t ret_ref = tag_ptr(ret_copy, true);
4399         return ret_ref;
4400 }
4401
4402 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
4403         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4404         switch(obj->tag) {
4405                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
4406                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
4407                 default: abort();
4408         }
4409 }
4410 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
4411         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4412         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
4413                         LDKCVec_SocketAddressZ some_var = obj->some;
4414                         uint64_tArray some_arr = NULL;
4415                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
4416                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
4417                         for (size_t p = 0; p < some_var.datalen; p++) {
4418                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
4419                                 some_arr_ptr[p] = some_conv_15_ref;
4420                         }
4421                         
4422         return some_arr;
4423 }
4424 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
4425         LDKChannelDerivationParameters ret = *owner->contents.result;
4426         ret.is_owned = false;
4427         return ret;
4428 }
4429 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
4430         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
4431         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
4432         uint64_t ret_ref = 0;
4433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4435         return ret_ref;
4436 }
4437
4438 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
4439 CHECK(!owner->result_ok);
4440         return DecodeError_clone(&*owner->contents.err);
4441 }
4442 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
4443         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
4444         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4445         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
4446         uint64_t ret_ref = tag_ptr(ret_copy, true);
4447         return ret_ref;
4448 }
4449
4450 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
4451         LDKHTLCDescriptor ret = *owner->contents.result;
4452         ret.is_owned = false;
4453         return ret;
4454 }
4455 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
4456         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
4457         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
4458         uint64_t ret_ref = 0;
4459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4461         return ret_ref;
4462 }
4463
4464 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
4465 CHECK(!owner->result_ok);
4466         return DecodeError_clone(&*owner->contents.err);
4467 }
4468 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
4469         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
4470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4471         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
4472         uint64_t ret_ref = tag_ptr(ret_copy, true);
4473         return ret_ref;
4474 }
4475
4476 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
4477         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
4478         for (size_t i = 0; i < ret.datalen; i++) {
4479                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
4480         }
4481         return ret;
4482 }
4483 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
4484         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
4485         for (size_t i = 0; i < ret.datalen; i++) {
4486                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
4487         }
4488         return ret;
4489 }
4490 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
4491         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
4492         for (size_t i = 0; i < ret.datalen; i++) {
4493                 ret.data[i] = Utxo_clone(&orig->data[i]);
4494         }
4495         return ret;
4496 }
4497 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
4498         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4499         switch(obj->tag) {
4500                 case LDKCOption_TxOutZ_Some: return 0;
4501                 case LDKCOption_TxOutZ_None: return 1;
4502                 default: abort();
4503         }
4504 }
4505 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
4506         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4507         assert(obj->tag == LDKCOption_TxOutZ_Some);
4508                         LDKTxOut* some_ref = &obj->some;
4509         return tag_ptr(some_ref, false);
4510 }
4511 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
4512         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
4513         for (size_t i = 0; i < ret.datalen; i++) {
4514                 ret.data[i] = Input_clone(&orig->data[i]);
4515         }
4516         return ret;
4517 }
4518 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4519         LDKCoinSelection ret = *owner->contents.result;
4520         ret.is_owned = false;
4521         return ret;
4522 }
4523 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
4524         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4525         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
4526         uint64_t ret_ref = 0;
4527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4529         return ret_ref;
4530 }
4531
4532 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4533 CHECK(!owner->result_ok);
4534         return *owner->contents.err;
4535 }
4536 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
4537         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4538         CResult_CoinSelectionNoneZ_get_err(owner_conv);
4539 }
4540
4541 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4542 CHECK(owner->result_ok);
4543         return CVec_UtxoZ_clone(&*owner->contents.result);
4544 }
4545 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
4546         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4547         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
4548         uint64_tArray ret_arr = NULL;
4549         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4550         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4551         for (size_t g = 0; g < ret_var.datalen; g++) {
4552                 LDKUtxo ret_conv_6_var = ret_var.data[g];
4553                 uint64_t ret_conv_6_ref = 0;
4554                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
4555                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
4556                 ret_arr_ptr[g] = ret_conv_6_ref;
4557         }
4558         
4559         FREE(ret_var.data);
4560         return ret_arr;
4561 }
4562
4563 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4564 CHECK(!owner->result_ok);
4565         return *owner->contents.err;
4566 }
4567 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
4568         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4569         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
4570 }
4571
4572 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4573         return owner->a;
4574 }
4575 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
4576         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4577         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
4578         return ret_conv;
4579 }
4580
4581 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4582         return owner->b;
4583 }
4584 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
4585         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4586         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
4587         return ret_conv;
4588 }
4589
4590 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
4591         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4592         switch(obj->tag) {
4593                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
4594                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
4595                 default: abort();
4596         }
4597 }
4598 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
4599         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4600         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
4601                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
4602                         *some_conv = obj->some;
4603                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
4604         return tag_ptr(some_conv, true);
4605 }
4606 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
4607         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4608         switch(obj->tag) {
4609                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
4610                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
4611                 default: abort();
4612         }
4613 }
4614 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
4615         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4616         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
4617                         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
4618         return some_conv;
4619 }
4620 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4621 CHECK(owner->result_ok);
4622         return ThirtyTwoBytes_clone(&*owner->contents.result);
4623 }
4624 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
4625         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4626         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4627         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
4628         return ret_arr;
4629 }
4630
4631 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4632 CHECK(!owner->result_ok);
4633         return APIError_clone(&*owner->contents.err);
4634 }
4635 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
4636         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4637         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4638         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
4639         uint64_t ret_ref = tag_ptr(ret_copy, true);
4640         return ret_ref;
4641 }
4642
4643 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
4644         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4645         switch(obj->tag) {
4646                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
4647                 case LDKRecentPaymentDetails_Pending: return 1;
4648                 case LDKRecentPaymentDetails_Fulfilled: return 2;
4649                 case LDKRecentPaymentDetails_Abandoned: return 3;
4650                 default: abort();
4651         }
4652 }
4653 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
4654         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4655         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
4656                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4657                         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
4658         return payment_id_arr;
4659 }
4660 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
4661         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4662         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4663                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4664                         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
4665         return payment_id_arr;
4666 }
4667 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
4668         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4669         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4670                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4671                         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
4672         return payment_hash_arr;
4673 }
4674 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
4675         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4676         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4677                         int64_t total_msat_conv = obj->pending.total_msat;
4678         return total_msat_conv;
4679 }
4680 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
4681         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4682         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4683                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4684                         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
4685         return payment_id_arr;
4686 }
4687 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
4688         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4689         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4690                         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
4691         return payment_hash_ref;
4692 }
4693 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
4694         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4695         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4696                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4697                         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
4698         return payment_id_arr;
4699 }
4700 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
4701         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4702         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4703                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4704                         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
4705         return payment_hash_arr;
4706 }
4707 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
4708         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
4709         for (size_t i = 0; i < ret.datalen; i++) {
4710                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
4711         }
4712         return ret;
4713 }
4714 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4715         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4716         switch(obj->tag) {
4717                 case LDKPaymentSendFailure_ParameterError: return 0;
4718                 case LDKPaymentSendFailure_PathParameterError: return 1;
4719                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4720                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4721                 case LDKPaymentSendFailure_PartialFailure: return 4;
4722                 default: abort();
4723         }
4724 }
4725 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4726         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4727         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4728                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4729         return parameter_error_ref;
4730 }
4731 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4732         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4733         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4734                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4735                         uint64_tArray path_parameter_error_arr = NULL;
4736                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4737                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4738                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4739                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4740                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4741                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4742                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4743                         }
4744                         
4745         return path_parameter_error_arr;
4746 }
4747 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4748         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4749         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4750                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4751                         uint64_tArray all_failed_resend_safe_arr = NULL;
4752                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4753                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4754                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4755                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4756                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4757                         }
4758                         
4759         return all_failed_resend_safe_arr;
4760 }
4761 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4762         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4763         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4764                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4765                         uint64_tArray results_arr = NULL;
4766                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4767                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4768                         for (size_t w = 0; w < results_var.datalen; w++) {
4769                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4770                                 *results_conv_22_conv = results_var.data[w];
4771                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4772                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4773                         }
4774                         
4775         return results_arr;
4776 }
4777 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4778         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4779         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4780                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4781                         uint64_t failed_paths_retry_ref = 0;
4782                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4783                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4784         return failed_paths_retry_ref;
4785 }
4786 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4787         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4788         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4789                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4790                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4791         return payment_id_arr;
4792 }
4793 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4794 CHECK(owner->result_ok);
4795         return *owner->contents.result;
4796 }
4797 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4798         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4799         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4800 }
4801
4802 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4803 CHECK(!owner->result_ok);
4804         return PaymentSendFailure_clone(&*owner->contents.err);
4805 }
4806 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4807         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4808         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4809         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4810         uint64_t ret_ref = tag_ptr(ret_copy, true);
4811         return ret_ref;
4812 }
4813
4814 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4815 CHECK(owner->result_ok);
4816         return *owner->contents.result;
4817 }
4818 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
4819         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4820         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
4821 }
4822
4823 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4824 CHECK(!owner->result_ok);
4825         return RetryableSendFailure_clone(&*owner->contents.err);
4826 }
4827 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
4828         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4829         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
4830         return ret_conv;
4831 }
4832
4833 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
4834 CHECK(owner->result_ok);
4835         return ThirtyTwoBytes_clone(&*owner->contents.result);
4836 }
4837 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
4838         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
4839         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4840         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4841         return ret_arr;
4842 }
4843
4844 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
4845 CHECK(!owner->result_ok);
4846         return PaymentSendFailure_clone(&*owner->contents.err);
4847 }
4848 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
4849         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
4850         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4851         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
4852         uint64_t ret_ref = tag_ptr(ret_copy, true);
4853         return ret_ref;
4854 }
4855
4856 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
4857 CHECK(owner->result_ok);
4858         return ThirtyTwoBytes_clone(&*owner->contents.result);
4859 }
4860 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
4861         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
4862         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4863         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
4864         return ret_arr;
4865 }
4866
4867 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
4868 CHECK(!owner->result_ok);
4869         return RetryableSendFailure_clone(&*owner->contents.err);
4870 }
4871 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
4872         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
4873         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
4874         return ret_conv;
4875 }
4876
4877 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
4878         return ThirtyTwoBytes_clone(&owner->a);
4879 }
4880 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
4881         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
4882         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4883         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
4884         return ret_arr;
4885 }
4886
4887 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
4888         return ThirtyTwoBytes_clone(&owner->b);
4889 }
4890 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
4891         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
4892         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4893         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
4894         return ret_arr;
4895 }
4896
4897 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
4898 CHECK(owner->result_ok);
4899         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
4900 }
4901 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
4902         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
4903         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
4904         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
4905         return tag_ptr(ret_conv, true);
4906 }
4907
4908 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
4909 CHECK(!owner->result_ok);
4910         return PaymentSendFailure_clone(&*owner->contents.err);
4911 }
4912 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
4913         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
4914         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4915         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
4916         uint64_t ret_ref = tag_ptr(ret_copy, true);
4917         return ret_ref;
4918 }
4919
4920 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
4921         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
4922         for (size_t i = 0; i < ret.datalen; i++) {
4923                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
4924         }
4925         return ret;
4926 }
4927 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
4928         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
4929         switch(obj->tag) {
4930                 case LDKProbeSendFailure_RouteNotFound: return 0;
4931                 case LDKProbeSendFailure_SendingFailed: return 1;
4932                 default: abort();
4933         }
4934 }
4935 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
4936         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
4937         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
4938                         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
4939         return sending_failed_ref;
4940 }
4941 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
4942 CHECK(owner->result_ok);
4943         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
4944 }
4945 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
4946         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
4947         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
4948         uint64_tArray ret_arr = NULL;
4949         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4950         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4951         for (size_t o = 0; o < ret_var.datalen; o++) {
4952                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
4953                 *ret_conv_40_conv = ret_var.data[o];
4954                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
4955         }
4956         
4957         FREE(ret_var.data);
4958         return ret_arr;
4959 }
4960
4961 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
4962 CHECK(!owner->result_ok);
4963         return ProbeSendFailure_clone(&*owner->contents.err);
4964 }
4965 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
4966         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
4967         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
4968         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
4969         uint64_t ret_ref = tag_ptr(ret_copy, true);
4970         return ret_ref;
4971 }
4972
4973 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
4974         return ThirtyTwoBytes_clone(&owner->a);
4975 }
4976 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(uint64_t owner) {
4977         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
4978         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4979         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data, 32);
4980         return ret_arr;
4981 }
4982
4983 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
4984         return owner->b;
4985 }
4986 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(uint64_t owner) {
4987         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
4988         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4989         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form, 33);
4990         return ret_arr;
4991 }
4992
4993 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
4994         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
4995         for (size_t i = 0; i < ret.datalen; i++) {
4996                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
4997         }
4998         return ret;
4999 }
5000 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5001 CHECK(owner->result_ok);
5002         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5003 }
5004 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5005         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5006         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5007         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5008         return tag_ptr(ret_conv, true);
5009 }
5010
5011 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5012 CHECK(!owner->result_ok);
5013         return *owner->contents.err;
5014 }
5015 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5016         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5017         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5018 }
5019
5020 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5021         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5022         ret.is_owned = false;
5023         return ret;
5024 }
5025 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5026         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5027         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5028         uint64_t ret_ref = 0;
5029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5031         return ret_ref;
5032 }
5033
5034 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5035 CHECK(!owner->result_ok);
5036         return DecodeError_clone(&*owner->contents.err);
5037 }
5038 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5039         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5040         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5041         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5042         uint64_t ret_ref = tag_ptr(ret_copy, true);
5043         return ret_ref;
5044 }
5045
5046 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5047         LDKChannelCounterparty ret = *owner->contents.result;
5048         ret.is_owned = false;
5049         return ret;
5050 }
5051 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5052         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5053         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5054         uint64_t ret_ref = 0;
5055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5057         return ret_ref;
5058 }
5059
5060 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5061 CHECK(!owner->result_ok);
5062         return DecodeError_clone(&*owner->contents.err);
5063 }
5064 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5065         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5066         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5067         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5068         uint64_t ret_ref = tag_ptr(ret_copy, true);
5069         return ret_ref;
5070 }
5071
5072 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5073         LDKChannelDetails ret = *owner->contents.result;
5074         ret.is_owned = false;
5075         return ret;
5076 }
5077 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5078         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5079         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5080         uint64_t ret_ref = 0;
5081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5083         return ret_ref;
5084 }
5085
5086 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5087 CHECK(!owner->result_ok);
5088         return DecodeError_clone(&*owner->contents.err);
5089 }
5090 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5091         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5092         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5093         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5094         uint64_t ret_ref = tag_ptr(ret_copy, true);
5095         return ret_ref;
5096 }
5097
5098 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5099         LDKPhantomRouteHints ret = *owner->contents.result;
5100         ret.is_owned = false;
5101         return ret;
5102 }
5103 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5104         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5105         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5106         uint64_t ret_ref = 0;
5107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5109         return ret_ref;
5110 }
5111
5112 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5113 CHECK(!owner->result_ok);
5114         return DecodeError_clone(&*owner->contents.err);
5115 }
5116 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5117         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5119         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5120         uint64_t ret_ref = tag_ptr(ret_copy, true);
5121         return ret_ref;
5122 }
5123
5124 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5125 CHECK(owner->result_ok);
5126         return ChannelShutdownState_clone(&*owner->contents.result);
5127 }
5128 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
5129         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5130         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
5131         return ret_conv;
5132 }
5133
5134 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5135 CHECK(!owner->result_ok);
5136         return DecodeError_clone(&*owner->contents.err);
5137 }
5138 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
5139         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5140         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5141         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
5142         uint64_t ret_ref = tag_ptr(ret_copy, true);
5143         return ret_ref;
5144 }
5145
5146 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5147         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5148         for (size_t i = 0; i < ret.datalen; i++) {
5149                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5150         }
5151         return ret;
5152 }
5153 typedef struct LDKWatch_JCalls {
5154         atomic_size_t refcnt;
5155         uint32_t instance_ptr;
5156 } LDKWatch_JCalls;
5157 static void LDKWatch_JCalls_free(void* this_arg) {
5158         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5159         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5160                 FREE(j_calls);
5161         }
5162 }
5163 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5164         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5165         LDKOutPoint funding_txo_var = funding_txo;
5166         uint64_t funding_txo_ref = 0;
5167         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5168         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5169         LDKChannelMonitor monitor_var = monitor;
5170         uint64_t monitor_ref = 0;
5171         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5172         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5173         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5174         void* ret_ptr = untag_ptr(ret);
5175         CHECK_ACCESS(ret_ptr);
5176         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
5177         FREE(untag_ptr(ret));
5178         return ret_conv;
5179 }
5180 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5181         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5182         LDKOutPoint funding_txo_var = funding_txo;
5183         uint64_t funding_txo_ref = 0;
5184         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5185         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5186         LDKChannelMonitorUpdate update_var = *update;
5187         uint64_t update_ref = 0;
5188         update_var = ChannelMonitorUpdate_clone(&update_var);
5189         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5190         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5191         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
5192         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5193         return ret_conv;
5194 }
5195 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5196         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5197         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
5198         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5199         ret_constr.datalen = ret->arr_len;
5200         if (ret_constr.datalen > 0)
5201                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5202         else
5203                 ret_constr.data = NULL;
5204         uint64_t* ret_vals = ret->elems;
5205         for (size_t x = 0; x < ret_constr.datalen; x++) {
5206                 uint64_t ret_conv_49 = ret_vals[x];
5207                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5208                 CHECK_ACCESS(ret_conv_49_ptr);
5209                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5210                 FREE(untag_ptr(ret_conv_49));
5211                 ret_constr.data[x] = ret_conv_49_conv;
5212         }
5213         FREE(ret);
5214         return ret_constr;
5215 }
5216 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5217         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5218         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5219 }
5220 static inline LDKWatch LDKWatch_init (JSValue o) {
5221         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5222         atomic_init(&calls->refcnt, 1);
5223         calls->instance_ptr = o;
5224
5225         LDKWatch ret = {
5226                 .this_arg = (void*) calls,
5227                 .watch_channel = watch_channel_LDKWatch_jcall,
5228                 .update_channel = update_channel_LDKWatch_jcall,
5229                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5230                 .free = LDKWatch_JCalls_free,
5231         };
5232         return ret;
5233 }
5234 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5235         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5236         *res_ptr = LDKWatch_init(o);
5237         return tag_ptr(res_ptr, true);
5238 }
5239 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5240         void* this_arg_ptr = untag_ptr(this_arg);
5241         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5242         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5243         LDKOutPoint funding_txo_conv;
5244         funding_txo_conv.inner = untag_ptr(funding_txo);
5245         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5246         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5247         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5248         LDKChannelMonitor monitor_conv;
5249         monitor_conv.inner = untag_ptr(monitor);
5250         monitor_conv.is_owned = ptr_is_owned(monitor);
5251         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5252         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5253         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
5254         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5255         return tag_ptr(ret_conv, true);
5256 }
5257
5258 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5259         void* this_arg_ptr = untag_ptr(this_arg);
5260         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5261         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5262         LDKOutPoint funding_txo_conv;
5263         funding_txo_conv.inner = untag_ptr(funding_txo);
5264         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5265         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5266         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5267         LDKChannelMonitorUpdate update_conv;
5268         update_conv.inner = untag_ptr(update);
5269         update_conv.is_owned = ptr_is_owned(update);
5270         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5271         update_conv.is_owned = false;
5272         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5273         return ret_conv;
5274 }
5275
5276 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5277         void* this_arg_ptr = untag_ptr(this_arg);
5278         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5279         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5280         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5281         uint64_tArray ret_arr = NULL;
5282         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5283         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5284         for (size_t x = 0; x < ret_var.datalen; x++) {
5285                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5286                 *ret_conv_49_conv = ret_var.data[x];
5287                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5288         }
5289         
5290         FREE(ret_var.data);
5291         return ret_arr;
5292 }
5293
5294 typedef struct LDKBroadcasterInterface_JCalls {
5295         atomic_size_t refcnt;
5296         uint32_t instance_ptr;
5297 } LDKBroadcasterInterface_JCalls;
5298 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5299         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5300         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5301                 FREE(j_calls);
5302         }
5303 }
5304 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
5305         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5306         LDKCVec_TransactionZ txs_var = txs;
5307         ptrArray txs_arr = NULL;
5308         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
5309         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
5310         for (size_t m = 0; m < txs_var.datalen; m++) {
5311                 LDKTransaction txs_conv_12_var = txs_var.data[m];
5312                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
5313                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
5314                 Transaction_free(txs_conv_12_var);
5315                 txs_arr_ptr[m] = txs_conv_12_arr;
5316         }
5317         
5318         FREE(txs_var.data);
5319         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
5320 }
5321 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5322         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5323         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5324 }
5325 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5326         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5327         atomic_init(&calls->refcnt, 1);
5328         calls->instance_ptr = o;
5329
5330         LDKBroadcasterInterface ret = {
5331                 .this_arg = (void*) calls,
5332                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
5333                 .free = LDKBroadcasterInterface_JCalls_free,
5334         };
5335         return ret;
5336 }
5337 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5338         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5339         *res_ptr = LDKBroadcasterInterface_init(o);
5340         return tag_ptr(res_ptr, true);
5341 }
5342 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
5343         void* this_arg_ptr = untag_ptr(this_arg);
5344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5345         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5346         LDKCVec_TransactionZ txs_constr;
5347         txs_constr.datalen = txs->arr_len;
5348         if (txs_constr.datalen > 0)
5349                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5350         else
5351                 txs_constr.data = NULL;
5352         int8_tArray* txs_vals = (void*) txs->elems;
5353         for (size_t m = 0; m < txs_constr.datalen; m++) {
5354                 int8_tArray txs_conv_12 = txs_vals[m];
5355                 LDKTransaction txs_conv_12_ref;
5356                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
5357                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
5358                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
5359                 txs_conv_12_ref.data_is_owned = true;
5360                 txs_constr.data[m] = txs_conv_12_ref;
5361         }
5362         FREE(txs);
5363         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
5364 }
5365
5366 typedef struct LDKEntropySource_JCalls {
5367         atomic_size_t refcnt;
5368         uint32_t instance_ptr;
5369 } LDKEntropySource_JCalls;
5370 static void LDKEntropySource_JCalls_free(void* this_arg) {
5371         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5372         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5373                 FREE(j_calls);
5374         }
5375 }
5376 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5377         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5378         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5379         LDKThirtyTwoBytes ret_ref;
5380         CHECK(ret->arr_len == 32);
5381         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5382         return ret_ref;
5383 }
5384 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5385         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5386         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5387 }
5388 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5389         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5390         atomic_init(&calls->refcnt, 1);
5391         calls->instance_ptr = o;
5392
5393         LDKEntropySource ret = {
5394                 .this_arg = (void*) calls,
5395                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5396                 .free = LDKEntropySource_JCalls_free,
5397         };
5398         return ret;
5399 }
5400 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5401         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5402         *res_ptr = LDKEntropySource_init(o);
5403         return tag_ptr(res_ptr, true);
5404 }
5405 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5406         void* this_arg_ptr = untag_ptr(this_arg);
5407         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5408         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5409         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5410         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5411         return ret_arr;
5412 }
5413
5414 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5415         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5416         switch(obj->tag) {
5417                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5418                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5419                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5420                 default: abort();
5421         }
5422 }
5423 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5424         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5425         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5426                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5427                         uint64_t channel_announcement_ref = 0;
5428                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5429                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5430         return channel_announcement_ref;
5431 }
5432 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5433         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5434         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5435                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5436                         uint64_t channel_update_ref = 0;
5437                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5438                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5439         return channel_update_ref;
5440 }
5441 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5442         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5443         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5444                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5445                         uint64_t node_announcement_ref = 0;
5446                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5447                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5448         return node_announcement_ref;
5449 }
5450 typedef struct LDKNodeSigner_JCalls {
5451         atomic_size_t refcnt;
5452         uint32_t instance_ptr;
5453 } LDKNodeSigner_JCalls;
5454 static void LDKNodeSigner_JCalls_free(void* this_arg) {
5455         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5456         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5457                 FREE(j_calls);
5458         }
5459 }
5460 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
5461         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5462         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
5463         LDKThirtyTwoBytes ret_ref;
5464         CHECK(ret->arr_len == 32);
5465         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5466         return ret_ref;
5467 }
5468 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
5469         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5470         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5471         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
5472         void* ret_ptr = untag_ptr(ret);
5473         CHECK_ACCESS(ret_ptr);
5474         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5475         FREE(untag_ptr(ret));
5476         return ret_conv;
5477 }
5478 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
5479         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5480         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5481         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5482         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5483         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
5484         *tweak_copy = tweak;
5485         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5486         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5487         void* ret_ptr = untag_ptr(ret);
5488         CHECK_ACCESS(ret_ptr);
5489         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
5490         FREE(untag_ptr(ret));
5491         return ret_conv;
5492 }
5493 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
5494         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5495         LDKu8slice hrp_bytes_var = hrp_bytes;
5496         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5497         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5498         LDKCVec_U5Z invoice_data_var = invoice_data;
5499         ptrArray invoice_data_arr = NULL;
5500         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5501         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5502         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5503                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5504                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5505         }
5506         
5507         FREE(invoice_data_var.data);
5508         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5509         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);
5510         void* ret_ptr = untag_ptr(ret);
5511         CHECK_ACCESS(ret_ptr);
5512         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5513         FREE(untag_ptr(ret));
5514         return ret_conv;
5515 }
5516 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
5517         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5518         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
5519         uint64_t invoice_request_ref = 0;
5520         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
5521         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5522         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
5523         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
5524         void* ret_ptr = untag_ptr(ret);
5525         CHECK_ACCESS(ret_ptr);
5526         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
5527         FREE(untag_ptr(ret));
5528         return ret_conv;
5529 }
5530 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
5531         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5532         LDKUnsignedBolt12Invoice invoice_var = *invoice;
5533         uint64_t invoice_ref = 0;
5534         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
5535         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5536         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
5537         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
5538         void* ret_ptr = untag_ptr(ret);
5539         CHECK_ACCESS(ret_ptr);
5540         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
5541         FREE(untag_ptr(ret));
5542         return ret_conv;
5543 }
5544 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
5545         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5546         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
5547         *msg_copy = msg;
5548         uint64_t msg_ref = tag_ptr(msg_copy, true);
5549         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
5550         void* ret_ptr = untag_ptr(ret);
5551         CHECK_ACCESS(ret_ptr);
5552         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
5553         FREE(untag_ptr(ret));
5554         return ret_conv;
5555 }
5556 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
5557         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
5558         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5559 }
5560 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
5561         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
5562         atomic_init(&calls->refcnt, 1);
5563         calls->instance_ptr = o;
5564
5565         LDKNodeSigner ret = {
5566                 .this_arg = (void*) calls,
5567                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
5568                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
5569                 .ecdh = ecdh_LDKNodeSigner_jcall,
5570                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
5571                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
5572                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
5573                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
5574                 .free = LDKNodeSigner_JCalls_free,
5575         };
5576         return ret;
5577 }
5578 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
5579         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
5580         *res_ptr = LDKNodeSigner_init(o);
5581         return tag_ptr(res_ptr, true);
5582 }
5583 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
5584         void* this_arg_ptr = untag_ptr(this_arg);
5585         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5586         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5587         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5588         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5589         return ret_arr;
5590 }
5591
5592 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
5593         void* this_arg_ptr = untag_ptr(this_arg);
5594         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5595         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5596         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5597         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5598         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5599         return tag_ptr(ret_conv, true);
5600 }
5601
5602 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) {
5603         void* this_arg_ptr = untag_ptr(this_arg);
5604         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5605         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5606         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5607         LDKPublicKey other_key_ref;
5608         CHECK(other_key->arr_len == 33);
5609         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5610         void* tweak_ptr = untag_ptr(tweak);
5611         CHECK_ACCESS(tweak_ptr);
5612         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
5613         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
5614         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
5615         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5616         return tag_ptr(ret_conv, true);
5617 }
5618
5619 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) {
5620         void* this_arg_ptr = untag_ptr(this_arg);
5621         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5622         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5623         LDKu8slice hrp_bytes_ref;
5624         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5625         hrp_bytes_ref.data = hrp_bytes->elems;
5626         LDKCVec_U5Z invoice_data_constr;
5627         invoice_data_constr.datalen = invoice_data->arr_len;
5628         if (invoice_data_constr.datalen > 0)
5629                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5630         else
5631                 invoice_data_constr.data = NULL;
5632         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5633         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5634                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5635                 
5636                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5637         }
5638         FREE(invoice_data);
5639         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5640         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5641         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
5642         FREE(hrp_bytes);
5643         return tag_ptr(ret_conv, true);
5644 }
5645
5646 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice_request"))) TS_NodeSigner_sign_bolt12_invoice_request(uint64_t this_arg, uint64_t invoice_request) {
5647         void* this_arg_ptr = untag_ptr(this_arg);
5648         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5649         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5650         LDKUnsignedInvoiceRequest invoice_request_conv;
5651         invoice_request_conv.inner = untag_ptr(invoice_request);
5652         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
5653         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
5654         invoice_request_conv.is_owned = false;
5655         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
5656         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
5657         return tag_ptr(ret_conv, true);
5658 }
5659
5660 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
5661         void* this_arg_ptr = untag_ptr(this_arg);
5662         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5663         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5664         LDKUnsignedBolt12Invoice invoice_conv;
5665         invoice_conv.inner = untag_ptr(invoice);
5666         invoice_conv.is_owned = ptr_is_owned(invoice);
5667         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
5668         invoice_conv.is_owned = false;
5669         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
5670         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
5671         return tag_ptr(ret_conv, true);
5672 }
5673
5674 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
5675         void* this_arg_ptr = untag_ptr(this_arg);
5676         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5677         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5678         void* msg_ptr = untag_ptr(msg);
5679         CHECK_ACCESS(msg_ptr);
5680         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
5681         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
5682         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
5683         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
5684         return tag_ptr(ret_conv, true);
5685 }
5686
5687 typedef struct LDKSignerProvider_JCalls {
5688         atomic_size_t refcnt;
5689         uint32_t instance_ptr;
5690 } LDKSignerProvider_JCalls;
5691 static void LDKSignerProvider_JCalls_free(void* this_arg) {
5692         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5693         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5694                 FREE(j_calls);
5695         }
5696 }
5697 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5698         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5699         jboolean inbound_conv = inbound;
5700         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5701         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5702         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5703         int8_tArray ret = (int8_tArray)js_invoke_function_ubuuuu(j_calls->instance_ptr, 30, inbound_conv, channel_value_satoshis_conv, (uint32_t)user_channel_id_arr, 0, 0, 0);
5704         LDKThirtyTwoBytes ret_ref;
5705         CHECK(ret->arr_len == 32);
5706         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5707         return ret_ref;
5708 }
5709 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5710         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5711         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5712         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5713         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5714         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 31, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0);
5715         void* ret_ptr = untag_ptr(ret);
5716         CHECK_ACCESS(ret_ptr);
5717         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
5718         FREE(untag_ptr(ret));
5719         return ret_conv;
5720 }
5721 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
5722         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5723         LDKu8slice reader_var = reader;
5724         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5725         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5726         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5727         void* ret_ptr = untag_ptr(ret);
5728         CHECK_ACCESS(ret_ptr);
5729         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
5730         FREE(untag_ptr(ret));
5731         return ret_conv;
5732 }
5733 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
5734         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5735         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0);
5736         void* ret_ptr = untag_ptr(ret);
5737         CHECK_ACCESS(ret_ptr);
5738         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
5739         FREE(untag_ptr(ret));
5740         return ret_conv;
5741 }
5742 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
5743         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5744         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
5745         void* ret_ptr = untag_ptr(ret);
5746         CHECK_ACCESS(ret_ptr);
5747         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
5748         FREE(untag_ptr(ret));
5749         return ret_conv;
5750 }
5751 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
5752         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
5753         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5754 }
5755 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
5756         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
5757         atomic_init(&calls->refcnt, 1);
5758         calls->instance_ptr = o;
5759
5760         LDKSignerProvider ret = {
5761                 .this_arg = (void*) calls,
5762                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
5763                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
5764                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
5765                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
5766                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
5767                 .free = LDKSignerProvider_JCalls_free,
5768         };
5769         return ret;
5770 }
5771 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
5772         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
5773         *res_ptr = LDKSignerProvider_init(o);
5774         return tag_ptr(res_ptr, true);
5775 }
5776 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) {
5777         void* this_arg_ptr = untag_ptr(this_arg);
5778         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5779         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5780         LDKU128 user_channel_id_ref;
5781         CHECK(user_channel_id->arr_len == 16);
5782         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
5783         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5784         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);
5785         return ret_arr;
5786 }
5787
5788 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) {
5789         void* this_arg_ptr = untag_ptr(this_arg);
5790         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5791         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5792         LDKThirtyTwoBytes channel_keys_id_ref;
5793         CHECK(channel_keys_id->arr_len == 32);
5794         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
5795         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
5796         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
5797         return tag_ptr(ret_ret, true);
5798 }
5799
5800 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5801         void* this_arg_ptr = untag_ptr(this_arg);
5802         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5803         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5804         LDKu8slice reader_ref;
5805         reader_ref.datalen = reader->arr_len;
5806         reader_ref.data = reader->elems;
5807         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
5808         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5809         FREE(reader);
5810         return tag_ptr(ret_conv, true);
5811 }
5812
5813 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
5814         void* this_arg_ptr = untag_ptr(this_arg);
5815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5816         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5817         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
5818         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5819         return tag_ptr(ret_conv, true);
5820 }
5821
5822 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
5823         void* this_arg_ptr = untag_ptr(this_arg);
5824         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5825         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5826         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
5827         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5828         return tag_ptr(ret_conv, true);
5829 }
5830
5831 typedef struct LDKFeeEstimator_JCalls {
5832         atomic_size_t refcnt;
5833         uint32_t instance_ptr;
5834 } LDKFeeEstimator_JCalls;
5835 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5836         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5837         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5838                 FREE(j_calls);
5839         }
5840 }
5841 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5842         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5843         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5844         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
5845 }
5846 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5847         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5848         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5849 }
5850 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5851         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5852         atomic_init(&calls->refcnt, 1);
5853         calls->instance_ptr = o;
5854
5855         LDKFeeEstimator ret = {
5856                 .this_arg = (void*) calls,
5857                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5858                 .free = LDKFeeEstimator_JCalls_free,
5859         };
5860         return ret;
5861 }
5862 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5863         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5864         *res_ptr = LDKFeeEstimator_init(o);
5865         return tag_ptr(res_ptr, true);
5866 }
5867 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) {
5868         void* this_arg_ptr = untag_ptr(this_arg);
5869         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5870         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5871         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5872         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5873         return ret_conv;
5874 }
5875
5876 typedef struct LDKRouter_JCalls {
5877         atomic_size_t refcnt;
5878         uint32_t instance_ptr;
5879 } LDKRouter_JCalls;
5880 static void LDKRouter_JCalls_free(void* this_arg) {
5881         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5882         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5883                 FREE(j_calls);
5884         }
5885 }
5886 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
5887         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5888         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
5889         memcpy(payer_arr->elems, payer.compressed_form, 33);
5890         LDKRouteParameters route_params_var = *route_params;
5891         uint64_t route_params_ref = 0;
5892         route_params_var = RouteParameters_clone(&route_params_var);
5893         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
5894         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
5895         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
5896         uint64_tArray first_hops_arr = NULL;
5897         if (first_hops != NULL) {
5898                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
5899                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
5900                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
5901                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
5902                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
5903                         uint64_t first_hops_conv_16_ref = 0;
5904                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
5905                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
5906                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
5907                 }
5908         
5909         }
5910         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
5911         uint64_t inflight_htlcs_ref = 0;
5912         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
5913         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
5914         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 36, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0);
5915         void* ret_ptr = untag_ptr(ret);
5916         CHECK_ACCESS(ret_ptr);
5917         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
5918         FREE(untag_ptr(ret));
5919         return ret_conv;
5920 }
5921 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) {
5922         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5923         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
5924         memcpy(payer_arr->elems, payer.compressed_form, 33);
5925         LDKRouteParameters route_params_var = *route_params;
5926         uint64_t route_params_ref = 0;
5927         route_params_var = RouteParameters_clone(&route_params_var);
5928         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
5929         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
5930         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
5931         uint64_tArray first_hops_arr = NULL;
5932         if (first_hops != NULL) {
5933                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
5934                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
5935                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
5936                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
5937                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
5938                         uint64_t first_hops_conv_16_ref = 0;
5939                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
5940                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
5941                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
5942                 }
5943         
5944         }
5945         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
5946         uint64_t inflight_htlcs_ref = 0;
5947         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
5948         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
5949         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
5950         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
5951         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
5952         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
5953         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 37, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, (uint32_t)_payment_hash_arr, (uint32_t)_payment_id_arr);
5954         void* ret_ptr = untag_ptr(ret);
5955         CHECK_ACCESS(ret_ptr);
5956         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
5957         FREE(untag_ptr(ret));
5958         return ret_conv;
5959 }
5960 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
5961         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
5962         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5963 }
5964 static inline LDKRouter LDKRouter_init (JSValue o) {
5965         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
5966         atomic_init(&calls->refcnt, 1);
5967         calls->instance_ptr = o;
5968
5969         LDKRouter ret = {
5970                 .this_arg = (void*) calls,
5971                 .find_route = find_route_LDKRouter_jcall,
5972                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
5973                 .free = LDKRouter_JCalls_free,
5974         };
5975         return ret;
5976 }
5977 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
5978         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
5979         *res_ptr = LDKRouter_init(o);
5980         return tag_ptr(res_ptr, true);
5981 }
5982 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) {
5983         void* this_arg_ptr = untag_ptr(this_arg);
5984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5985         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
5986         LDKPublicKey payer_ref;
5987         CHECK(payer->arr_len == 33);
5988         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
5989         LDKRouteParameters route_params_conv;
5990         route_params_conv.inner = untag_ptr(route_params);
5991         route_params_conv.is_owned = ptr_is_owned(route_params);
5992         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
5993         route_params_conv.is_owned = false;
5994         LDKCVec_ChannelDetailsZ first_hops_constr;
5995         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
5996         if (first_hops != 0) {
5997                 first_hops_constr.datalen = first_hops->arr_len;
5998                 if (first_hops_constr.datalen > 0)
5999                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6000                 else
6001                         first_hops_constr.data = NULL;
6002                 uint64_t* first_hops_vals = first_hops->elems;
6003                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6004                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6005                         LDKChannelDetails first_hops_conv_16_conv;
6006                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6007                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6008                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6009                         first_hops_conv_16_conv.is_owned = false;
6010                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6011                 }
6012                 FREE(first_hops);
6013                 first_hops_ptr = &first_hops_constr;
6014         }
6015         LDKInFlightHtlcs inflight_htlcs_conv;
6016         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6017         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6018         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6019         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6020         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6021         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
6022         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6023         return tag_ptr(ret_conv, true);
6024 }
6025
6026 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) {
6027         void* this_arg_ptr = untag_ptr(this_arg);
6028         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6029         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6030         LDKPublicKey payer_ref;
6031         CHECK(payer->arr_len == 33);
6032         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6033         LDKRouteParameters route_params_conv;
6034         route_params_conv.inner = untag_ptr(route_params);
6035         route_params_conv.is_owned = ptr_is_owned(route_params);
6036         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6037         route_params_conv.is_owned = false;
6038         LDKCVec_ChannelDetailsZ first_hops_constr;
6039         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6040         if (first_hops != 0) {
6041                 first_hops_constr.datalen = first_hops->arr_len;
6042                 if (first_hops_constr.datalen > 0)
6043                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6044                 else
6045                         first_hops_constr.data = NULL;
6046                 uint64_t* first_hops_vals = first_hops->elems;
6047                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6048                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6049                         LDKChannelDetails first_hops_conv_16_conv;
6050                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6051                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6052                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6053                         first_hops_conv_16_conv.is_owned = false;
6054                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6055                 }
6056                 FREE(first_hops);
6057                 first_hops_ptr = &first_hops_constr;
6058         }
6059         LDKInFlightHtlcs inflight_htlcs_conv;
6060         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6061         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6062         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6063         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6064         LDKThirtyTwoBytes _payment_hash_ref;
6065         CHECK(_payment_hash->arr_len == 32);
6066         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6067         LDKThirtyTwoBytes _payment_id_ref;
6068         CHECK(_payment_id->arr_len == 32);
6069         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6070         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6071         *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);
6072         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6073         return tag_ptr(ret_conv, true);
6074 }
6075
6076 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6077         return ThirtyTwoBytes_clone(&owner->a);
6078 }
6079 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
6080         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6081         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6082         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
6083         return ret_arr;
6084 }
6085
6086 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6087         LDKChannelManager ret = owner->b;
6088         ret.is_owned = false;
6089         return ret;
6090 }
6091 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
6092         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6093         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
6094         uint64_t ret_ref = 0;
6095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6097         return ret_ref;
6098 }
6099
6100 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6101 CHECK(owner->result_ok);
6102         return &*owner->contents.result;
6103 }
6104 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6105         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6106         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6107         return ret_ret;
6108 }
6109
6110 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6111 CHECK(!owner->result_ok);
6112         return DecodeError_clone(&*owner->contents.err);
6113 }
6114 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6115         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6116         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6117         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
6118         uint64_t ret_ref = tag_ptr(ret_copy, true);
6119         return ret_ref;
6120 }
6121
6122 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
6123         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6124         switch(obj->tag) {
6125                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
6126                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
6127                 default: abort();
6128         }
6129 }
6130 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
6131         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6132         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
6133                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
6134         return fixed_limit_msat_conv;
6135 }
6136 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
6137         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6138         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
6139                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
6140         return fee_rate_multiplier_conv;
6141 }
6142 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6143 CHECK(owner->result_ok);
6144         return MaxDustHTLCExposure_clone(&*owner->contents.result);
6145 }
6146 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
6147         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6148         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
6149         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
6150         uint64_t ret_ref = tag_ptr(ret_copy, true);
6151         return ret_ref;
6152 }
6153
6154 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6155 CHECK(!owner->result_ok);
6156         return DecodeError_clone(&*owner->contents.err);
6157 }
6158 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
6159         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6160         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6161         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
6162         uint64_t ret_ref = tag_ptr(ret_copy, true);
6163         return ret_ref;
6164 }
6165
6166 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6167         LDKChannelConfig ret = *owner->contents.result;
6168         ret.is_owned = false;
6169         return ret;
6170 }
6171 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6172         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6173         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6174         uint64_t ret_ref = 0;
6175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6177         return ret_ref;
6178 }
6179
6180 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6181 CHECK(!owner->result_ok);
6182         return DecodeError_clone(&*owner->contents.err);
6183 }
6184 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6185         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6186         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6187         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6188         uint64_t ret_ref = tag_ptr(ret_copy, true);
6189         return ret_ref;
6190 }
6191
6192 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
6193         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6194         switch(obj->tag) {
6195                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
6196                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
6197                 default: abort();
6198         }
6199 }
6200 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
6201         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6202         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
6203                         uint64_t some_ref = tag_ptr(&obj->some, false);
6204         return some_ref;
6205 }
6206 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6207         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6208         switch(obj->tag) {
6209                 case LDKCOption_APIErrorZ_Some: return 0;
6210                 case LDKCOption_APIErrorZ_None: return 1;
6211                 default: abort();
6212         }
6213 }
6214 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6215         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6216         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6217                         uint64_t some_ref = tag_ptr(&obj->some, false);
6218         return some_ref;
6219 }
6220 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6221 CHECK(owner->result_ok);
6222         return COption_APIErrorZ_clone(&*owner->contents.result);
6223 }
6224 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6225         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6226         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6227         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6228         uint64_t ret_ref = tag_ptr(ret_copy, true);
6229         return ret_ref;
6230 }
6231
6232 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6233 CHECK(!owner->result_ok);
6234         return DecodeError_clone(&*owner->contents.err);
6235 }
6236 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6237         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6239         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6240         uint64_t ret_ref = tag_ptr(ret_copy, true);
6241         return ret_ref;
6242 }
6243
6244 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6245         LDKChannelMonitorUpdate ret = *owner->contents.result;
6246         ret.is_owned = false;
6247         return ret;
6248 }
6249 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6250         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6251         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6252         uint64_t ret_ref = 0;
6253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6255         return ret_ref;
6256 }
6257
6258 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6259 CHECK(!owner->result_ok);
6260         return DecodeError_clone(&*owner->contents.err);
6261 }
6262 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6263         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6265         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6266         uint64_t ret_ref = tag_ptr(ret_copy, true);
6267         return ret_ref;
6268 }
6269
6270 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6271         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6272         switch(obj->tag) {
6273                 case LDKCOption_MonitorEventZ_Some: return 0;
6274                 case LDKCOption_MonitorEventZ_None: return 1;
6275                 default: abort();
6276         }
6277 }
6278 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6279         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6280         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6281                         uint64_t some_ref = tag_ptr(&obj->some, false);
6282         return some_ref;
6283 }
6284 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6285 CHECK(owner->result_ok);
6286         return COption_MonitorEventZ_clone(&*owner->contents.result);
6287 }
6288 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6289         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6290         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6291         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6292         uint64_t ret_ref = tag_ptr(ret_copy, true);
6293         return ret_ref;
6294 }
6295
6296 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6297 CHECK(!owner->result_ok);
6298         return DecodeError_clone(&*owner->contents.err);
6299 }
6300 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6301         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6302         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6303         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6304         uint64_t ret_ref = tag_ptr(ret_copy, true);
6305         return ret_ref;
6306 }
6307
6308 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6309         LDKHTLCUpdate ret = *owner->contents.result;
6310         ret.is_owned = false;
6311         return ret;
6312 }
6313 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6314         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6315         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6316         uint64_t ret_ref = 0;
6317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6319         return ret_ref;
6320 }
6321
6322 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6323 CHECK(!owner->result_ok);
6324         return DecodeError_clone(&*owner->contents.err);
6325 }
6326 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6327         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6328         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6329         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6330         uint64_t ret_ref = tag_ptr(ret_copy, true);
6331         return ret_ref;
6332 }
6333
6334 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
6335         LDKOutPoint ret = owner->a;
6336         ret.is_owned = false;
6337         return ret;
6338 }
6339 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
6340         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
6341         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
6342         uint64_t ret_ref = 0;
6343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6345         return ret_ref;
6346 }
6347
6348 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
6349         return CVec_u8Z_clone(&owner->b);
6350 }
6351 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
6352         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
6353         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
6354         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6355         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6356         CVec_u8Z_free(ret_var);
6357         return ret_arr;
6358 }
6359
6360 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
6361         return owner->a;
6362 }
6363 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
6364         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
6365         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
6366         return ret_conv;
6367 }
6368
6369 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
6370         return CVec_u8Z_clone(&owner->b);
6371 }
6372 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
6373         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
6374         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
6375         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6376         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6377         CVec_u8Z_free(ret_var);
6378         return ret_arr;
6379 }
6380
6381 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
6382         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
6383         for (size_t i = 0; i < ret.datalen; i++) {
6384                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
6385         }
6386         return ret;
6387 }
6388 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
6389         return ThirtyTwoBytes_clone(&owner->a);
6390 }
6391 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
6392         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
6393         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6394         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
6395         return ret_arr;
6396 }
6397
6398 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
6399         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
6400 }
6401 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
6402         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
6403         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
6404         uint64_tArray ret_arr = NULL;
6405         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6406         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6407         for (size_t x = 0; x < ret_var.datalen; x++) {
6408                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
6409                 *ret_conv_23_conv = ret_var.data[x];
6410                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
6411         }
6412         
6413         FREE(ret_var.data);
6414         return ret_arr;
6415 }
6416
6417 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
6418         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ clone bytes"), .datalen = orig->datalen };
6419         for (size_t i = 0; i < ret.datalen; i++) {
6420                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
6421         }
6422         return ret;
6423 }
6424 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
6425         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
6426         for (size_t i = 0; i < ret.datalen; i++) {
6427                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
6428         }
6429         return ret;
6430 }
6431 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6432         return owner->a;
6433 }
6434 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6435         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6436         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6437         return ret_conv;
6438 }
6439
6440 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6441         return TxOut_clone(&owner->b);
6442 }
6443 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6444         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6445         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6446         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6447         return tag_ptr(ret_ref, true);
6448 }
6449
6450 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6451         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6452         for (size_t i = 0; i < ret.datalen; i++) {
6453                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6454         }
6455         return ret;
6456 }
6457 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6458         return ThirtyTwoBytes_clone(&owner->a);
6459 }
6460 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6461         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6462         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6463         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6464         return ret_arr;
6465 }
6466
6467 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6468         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6469 }
6470 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6471         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6472         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6473         uint64_tArray ret_arr = NULL;
6474         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6475         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6476         for (size_t u = 0; u < ret_var.datalen; u++) {
6477                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6478                 *ret_conv_20_conv = ret_var.data[u];
6479                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6480         }
6481         
6482         FREE(ret_var.data);
6483         return ret_arr;
6484 }
6485
6486 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
6487         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
6488         for (size_t i = 0; i < ret.datalen; i++) {
6489                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6490         }
6491         return ret;
6492 }
6493 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6494         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6495         switch(obj->tag) {
6496                 case LDKBalance_ClaimableOnChannelClose: return 0;
6497                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6498                 case LDKBalance_ContentiousClaimable: return 2;
6499                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6500                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6501                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6502                 default: abort();
6503         }
6504 }
6505 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
6506         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6507         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6508                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
6509         return amount_satoshis_conv;
6510 }
6511 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
6512         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6513         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6514                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
6515         return amount_satoshis_conv;
6516 }
6517 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6518         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6519         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6520                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6521         return confirmation_height_conv;
6522 }
6523 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
6524         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6525         assert(obj->tag == LDKBalance_ContentiousClaimable);
6526                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
6527         return amount_satoshis_conv;
6528 }
6529 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6530         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6531         assert(obj->tag == LDKBalance_ContentiousClaimable);
6532                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6533         return timeout_height_conv;
6534 }
6535 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
6536         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6537         assert(obj->tag == LDKBalance_ContentiousClaimable);
6538                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6539                         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
6540         return payment_hash_arr;
6541 }
6542 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
6543         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6544         assert(obj->tag == LDKBalance_ContentiousClaimable);
6545                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6546                         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
6547         return payment_preimage_arr;
6548 }
6549 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
6550         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6551         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6552                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
6553         return amount_satoshis_conv;
6554 }
6555 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6556         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6557         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6558                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6559         return claimable_height_conv;
6560 }
6561 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
6562         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6563         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6564                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6565                         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
6566         return payment_hash_arr;
6567 }
6568 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
6569         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6570         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6571                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
6572         return amount_satoshis_conv;
6573 }
6574 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6575         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6576         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6577                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6578         return expiry_height_conv;
6579 }
6580 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
6581         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6582         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6583                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6584                         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
6585         return payment_hash_arr;
6586 }
6587 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
6588         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6589         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6590                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
6591         return amount_satoshis_conv;
6592 }
6593 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6594         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6595         for (size_t i = 0; i < ret.datalen; i++) {
6596                 ret.data[i] = Balance_clone(&orig->data[i]);
6597         }
6598         return ret;
6599 }
6600 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
6601         return ThirtyTwoBytes_clone(&owner->a);
6602 }
6603 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
6604         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
6605         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6606         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
6607         return ret_arr;
6608 }
6609
6610 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
6611         LDKChannelMonitor ret = owner->b;
6612         ret.is_owned = false;
6613         return ret;
6614 }
6615 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
6616         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
6617         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
6618         uint64_t ret_ref = 0;
6619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6621         return ret_ref;
6622 }
6623
6624 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6625 CHECK(owner->result_ok);
6626         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
6627 }
6628 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6629         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6630         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
6631         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6632         return tag_ptr(ret_conv, true);
6633 }
6634
6635 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6636 CHECK(!owner->result_ok);
6637         return DecodeError_clone(&*owner->contents.err);
6638 }
6639 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6640         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6641         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6642         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6643         uint64_t ret_ref = tag_ptr(ret_copy, true);
6644         return ret_ref;
6645 }
6646
6647 typedef struct LDKType_JCalls {
6648         atomic_size_t refcnt;
6649         uint32_t instance_ptr;
6650 } LDKType_JCalls;
6651 static void LDKType_JCalls_free(void* this_arg) {
6652         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6653         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6654                 FREE(j_calls);
6655         }
6656 }
6657 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6658         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6659         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
6660 }
6661 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6662         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6663         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
6664         LDKStr ret_conv = str_ref_to_owned_c(ret);
6665         return ret_conv;
6666 }
6667 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6668         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6669         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0);
6670         LDKCVec_u8Z ret_ref;
6671         ret_ref.datalen = ret->arr_len;
6672         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6673         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6674         return ret_ref;
6675 }
6676 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6677         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6678         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6679 }
6680 static inline LDKType LDKType_init (JSValue o) {
6681         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6682         atomic_init(&calls->refcnt, 1);
6683         calls->instance_ptr = o;
6684
6685         LDKType ret = {
6686                 .this_arg = (void*) calls,
6687                 .type_id = type_id_LDKType_jcall,
6688                 .debug_str = debug_str_LDKType_jcall,
6689                 .write = write_LDKType_jcall,
6690                 .cloned = LDKType_JCalls_cloned,
6691                 .free = LDKType_JCalls_free,
6692         };
6693         return ret;
6694 }
6695 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
6696         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6697         *res_ptr = LDKType_init(o);
6698         return tag_ptr(res_ptr, true);
6699 }
6700 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
6701         void* this_arg_ptr = untag_ptr(this_arg);
6702         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6703         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6704         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6705         return ret_conv;
6706 }
6707
6708 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
6709         void* this_arg_ptr = untag_ptr(this_arg);
6710         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6711         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6712         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6713         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6714         Str_free(ret_str);
6715         return ret_conv;
6716 }
6717
6718 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
6719         void* this_arg_ptr = untag_ptr(this_arg);
6720         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6721         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6722         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6723         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6724         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6725         CVec_u8Z_free(ret_var);
6726         return ret_arr;
6727 }
6728
6729 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6730         return owner->a;
6731 }
6732 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6733         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6734         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6735         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6736         return ret_arr;
6737 }
6738
6739 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6740         return Type_clone(&owner->b);
6741 }
6742 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6743         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6744         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6745         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6746         return tag_ptr(ret_ret, true);
6747 }
6748
6749 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6750         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6751         for (size_t i = 0; i < ret.datalen; i++) {
6752                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6753         }
6754         return ret;
6755 }
6756 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
6757         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6758         switch(obj->tag) {
6759                 case LDKOffersMessage_InvoiceRequest: return 0;
6760                 case LDKOffersMessage_Invoice: return 1;
6761                 case LDKOffersMessage_InvoiceError: return 2;
6762                 default: abort();
6763         }
6764 }
6765 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
6766         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6767         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
6768                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
6769                         uint64_t invoice_request_ref = 0;
6770                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6771                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
6772         return invoice_request_ref;
6773 }
6774 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
6775         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6776         assert(obj->tag == LDKOffersMessage_Invoice);
6777                         LDKBolt12Invoice invoice_var = obj->invoice;
6778                         uint64_t invoice_ref = 0;
6779                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6780                         invoice_ref = tag_ptr(invoice_var.inner, false);
6781         return invoice_ref;
6782 }
6783 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
6784         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6785         assert(obj->tag == LDKOffersMessage_InvoiceError);
6786                         LDKInvoiceError invoice_error_var = obj->invoice_error;
6787                         uint64_t invoice_error_ref = 0;
6788                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
6789                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
6790         return invoice_error_ref;
6791 }
6792 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
6793         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
6794         switch(obj->tag) {
6795                 case LDKCOption_OffersMessageZ_Some: return 0;
6796                 case LDKCOption_OffersMessageZ_None: return 1;
6797                 default: abort();
6798         }
6799 }
6800 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
6801         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
6802         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
6803                         uint64_t some_ref = tag_ptr(&obj->some, false);
6804         return some_ref;
6805 }
6806 typedef struct LDKCustomOnionMessageContents_JCalls {
6807         atomic_size_t refcnt;
6808         uint32_t instance_ptr;
6809 } LDKCustomOnionMessageContents_JCalls;
6810 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
6811         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6812         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6813                 FREE(j_calls);
6814         }
6815 }
6816 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6817         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6818         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
6819 }
6820 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6821         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6822         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
6823         LDKCVec_u8Z ret_ref;
6824         ret_ref.datalen = ret->arr_len;
6825         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6826         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6827         return ret_ref;
6828 }
6829 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
6830         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
6831         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6832 }
6833 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
6834         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
6835         atomic_init(&calls->refcnt, 1);
6836         calls->instance_ptr = o;
6837
6838         LDKCustomOnionMessageContents ret = {
6839                 .this_arg = (void*) calls,
6840                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
6841                 .write = write_LDKCustomOnionMessageContents_jcall,
6842                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
6843                 .free = LDKCustomOnionMessageContents_JCalls_free,
6844         };
6845         return ret;
6846 }
6847 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
6848         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6849         *res_ptr = LDKCustomOnionMessageContents_init(o);
6850         return tag_ptr(res_ptr, true);
6851 }
6852 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
6853         void* this_arg_ptr = untag_ptr(this_arg);
6854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6855         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6856         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6857         return ret_conv;
6858 }
6859
6860 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
6861         void* this_arg_ptr = untag_ptr(this_arg);
6862         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6863         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6864         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6865         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6866         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6867         CVec_u8Z_free(ret_var);
6868         return ret_arr;
6869 }
6870
6871 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
6872         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6873         switch(obj->tag) {
6874                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
6875                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
6876                 default: abort();
6877         }
6878 }
6879 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
6880         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6881         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
6882                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6883                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
6884         return tag_ptr(some_ret, true);
6885 }
6886 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6887 CHECK(owner->result_ok);
6888         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
6889 }
6890 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
6891         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6892         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
6893         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
6894         uint64_t ret_ref = tag_ptr(ret_copy, true);
6895         return ret_ref;
6896 }
6897
6898 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6899 CHECK(!owner->result_ok);
6900         return DecodeError_clone(&*owner->contents.err);
6901 }
6902 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
6903         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6904         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6905         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
6906         uint64_t ret_ref = tag_ptr(ret_copy, true);
6907         return ret_ref;
6908 }
6909
6910 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
6911         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6912         switch(obj->tag) {
6913                 case LDKCOption_TypeZ_Some: return 0;
6914                 case LDKCOption_TypeZ_None: return 1;
6915                 default: abort();
6916         }
6917 }
6918 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
6919         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6920         assert(obj->tag == LDKCOption_TypeZ_Some);
6921                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6922                         *some_ret = Type_clone(&obj->some);
6923         return tag_ptr(some_ret, true);
6924 }
6925 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6926 CHECK(owner->result_ok);
6927         return COption_TypeZ_clone(&*owner->contents.result);
6928 }
6929 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
6930         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6931         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6932         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6933         uint64_t ret_ref = tag_ptr(ret_copy, true);
6934         return ret_ref;
6935 }
6936
6937 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6938 CHECK(!owner->result_ok);
6939         return DecodeError_clone(&*owner->contents.err);
6940 }
6941 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
6942         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6943         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6944         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6945         uint64_t ret_ref = tag_ptr(ret_copy, true);
6946         return ret_ref;
6947 }
6948
6949 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
6950         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
6951         switch(obj->tag) {
6952                 case LDKCOption_SocketAddressZ_Some: return 0;
6953                 case LDKCOption_SocketAddressZ_None: return 1;
6954                 default: abort();
6955         }
6956 }
6957 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
6958         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
6959         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
6960                         uint64_t some_ref = tag_ptr(&obj->some, false);
6961         return some_ref;
6962 }
6963 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
6964         return owner->a;
6965 }
6966 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(uint64_t owner) {
6967         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
6968         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6969         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
6970         return ret_arr;
6971 }
6972
6973 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
6974         return COption_SocketAddressZ_clone(&owner->b);
6975 }
6976 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(uint64_t owner) {
6977         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
6978         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
6979         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
6980         uint64_t ret_ref = tag_ptr(ret_copy, true);
6981         return ret_ref;
6982 }
6983
6984 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
6985         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
6986         for (size_t i = 0; i < ret.datalen; i++) {
6987                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
6988         }
6989         return ret;
6990 }
6991 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6992 CHECK(owner->result_ok);
6993         return CVec_u8Z_clone(&*owner->contents.result);
6994 }
6995 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6996         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6997         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6998         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6999         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7000         CVec_u8Z_free(ret_var);
7001         return ret_arr;
7002 }
7003
7004 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7005         LDKPeerHandleError ret = *owner->contents.err;
7006         ret.is_owned = false;
7007         return ret;
7008 }
7009 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7010         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7011         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7012         uint64_t ret_ref = 0;
7013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7015         return ret_ref;
7016 }
7017
7018 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7019 CHECK(owner->result_ok);
7020         return *owner->contents.result;
7021 }
7022 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7023         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7024         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7025 }
7026
7027 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7028         LDKPeerHandleError ret = *owner->contents.err;
7029         ret.is_owned = false;
7030         return ret;
7031 }
7032 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7033         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7034         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7035         uint64_t ret_ref = 0;
7036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7038         return ret_ref;
7039 }
7040
7041 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7042 CHECK(owner->result_ok);
7043         return *owner->contents.result;
7044 }
7045 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7046         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7047         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7048         return ret_conv;
7049 }
7050
7051 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7052         LDKPeerHandleError ret = *owner->contents.err;
7053         ret.is_owned = false;
7054         return ret;
7055 }
7056 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7057         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7058         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7059         uint64_t ret_ref = 0;
7060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7062         return ret_ref;
7063 }
7064
7065 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7066         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7067         switch(obj->tag) {
7068                 case LDKGraphSyncError_DecodeError: return 0;
7069                 case LDKGraphSyncError_LightningError: return 1;
7070                 default: abort();
7071         }
7072 }
7073 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7074         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7075         assert(obj->tag == LDKGraphSyncError_DecodeError);
7076                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7077         return decode_error_ref;
7078 }
7079 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7080         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7081         assert(obj->tag == LDKGraphSyncError_LightningError);
7082                         LDKLightningError lightning_error_var = obj->lightning_error;
7083                         uint64_t lightning_error_ref = 0;
7084                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7085                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7086         return lightning_error_ref;
7087 }
7088 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7089 CHECK(owner->result_ok);
7090         return *owner->contents.result;
7091 }
7092 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7093         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7094         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7095         return ret_conv;
7096 }
7097
7098 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7099 CHECK(!owner->result_ok);
7100         return GraphSyncError_clone(&*owner->contents.err);
7101 }
7102 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7103         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7104         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7105         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7106         uint64_t ret_ref = tag_ptr(ret_copy, true);
7107         return ret_ref;
7108 }
7109
7110 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7111 CHECK(owner->result_ok);
7112         return CVec_u8Z_clone(&*owner->contents.result);
7113 }
7114 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
7115         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7116         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
7117         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7118         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7119         CVec_u8Z_free(ret_var);
7120         return ret_arr;
7121 }
7122
7123 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7124 CHECK(!owner->result_ok);
7125         return *owner->contents.err;
7126 }
7127 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
7128         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7129         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
7130         return ret_conv;
7131 }
7132
7133 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7134 CHECK(owner->result_ok);
7135         return *owner->contents.result;
7136 }
7137 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
7138         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7139         CResult_NoneIOErrorZ_get_ok(owner_conv);
7140 }
7141
7142 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7143 CHECK(!owner->result_ok);
7144         return *owner->contents.err;
7145 }
7146 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
7147         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7148         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
7149         return ret_conv;
7150 }
7151
7152 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7153 CHECK(owner->result_ok);
7154         return *owner->contents.result;
7155 }
7156 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
7157         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7158         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
7159         ptrArray ret_arr = NULL;
7160         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
7161         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
7162         for (size_t i = 0; i < ret_var.datalen; i++) {
7163                 LDKStr ret_conv_8_str = ret_var.data[i];
7164                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
7165                 ret_arr_ptr[i] = ret_conv_8_conv;
7166         }
7167         
7168         return ret_arr;
7169 }
7170
7171 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7172 CHECK(!owner->result_ok);
7173         return *owner->contents.err;
7174 }
7175 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
7176         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7177         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
7178         return ret_conv;
7179 }
7180
7181 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
7182         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
7183         for (size_t i = 0; i < ret.datalen; i++) {
7184                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
7185         }
7186         return ret;
7187 }
7188 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7189 CHECK(owner->result_ok);
7190         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
7191 }
7192 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
7193         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7194         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
7195         uint64_tArray ret_arr = NULL;
7196         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7197         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7198         for (size_t o = 0; o < ret_var.datalen; o++) {
7199                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7200                 *ret_conv_40_conv = ret_var.data[o];
7201                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7202         }
7203         
7204         FREE(ret_var.data);
7205         return ret_arr;
7206 }
7207
7208 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7209 CHECK(!owner->result_ok);
7210         return *owner->contents.err;
7211 }
7212 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
7213         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7214         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
7215         return ret_conv;
7216 }
7217
7218 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
7219 CHECK(owner->result_ok);
7220         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7221 }
7222 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
7223         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
7224         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7225         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
7226         return tag_ptr(ret_conv, true);
7227 }
7228
7229 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
7230 CHECK(!owner->result_ok);
7231         return *owner->contents.err;
7232 }
7233 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
7234         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
7235         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
7236         return ret_conv;
7237 }
7238
7239 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
7240         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
7241         switch(obj->tag) {
7242                 case LDKCOption_SecretKeyZ_Some: return 0;
7243                 case LDKCOption_SecretKeyZ_None: return 1;
7244                 default: abort();
7245         }
7246 }
7247 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
7248         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
7249         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
7250                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
7251                         memcpy(some_arr->elems, obj->some.bytes, 32);
7252         return some_arr;
7253 }
7254 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
7255         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
7256         ret.is_owned = false;
7257         return ret;
7258 }
7259 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
7260         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
7261         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
7262         uint64_t ret_ref = 0;
7263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7265         return ret_ref;
7266 }
7267
7268 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
7269 CHECK(!owner->result_ok);
7270         return *owner->contents.err;
7271 }
7272 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
7273         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
7274         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
7275 }
7276
7277 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
7278         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
7279         for (size_t i = 0; i < ret.datalen; i++) {
7280                 ret.data[i] = Witness_clone(&orig->data[i]);
7281         }
7282         return ret;
7283 }
7284 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
7285         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
7286         switch(obj->tag) {
7287                 case LDKCOption_i64Z_Some: return 0;
7288                 case LDKCOption_i64Z_None: return 1;
7289                 default: abort();
7290         }
7291 }
7292 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
7293         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
7294         assert(obj->tag == LDKCOption_i64Z_Some);
7295                         int64_t some_conv = obj->some;
7296         return some_conv;
7297 }
7298 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
7299 CHECK(owner->result_ok);
7300         return SocketAddress_clone(&*owner->contents.result);
7301 }
7302 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
7303         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
7304         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7305         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
7306         uint64_t ret_ref = tag_ptr(ret_copy, true);
7307         return ret_ref;
7308 }
7309
7310 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
7311 CHECK(!owner->result_ok);
7312         return DecodeError_clone(&*owner->contents.err);
7313 }
7314 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
7315         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
7316         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7317         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
7318         uint64_t ret_ref = tag_ptr(ret_copy, true);
7319         return ret_ref;
7320 }
7321
7322 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
7323 CHECK(owner->result_ok);
7324         return SocketAddress_clone(&*owner->contents.result);
7325 }
7326 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
7327         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
7328         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7329         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
7330         uint64_t ret_ref = tag_ptr(ret_copy, true);
7331         return ret_ref;
7332 }
7333
7334 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
7335 CHECK(!owner->result_ok);
7336         return SocketAddressParseError_clone(&*owner->contents.err);
7337 }
7338 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
7339         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
7340         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
7341         return ret_conv;
7342 }
7343
7344 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7345         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7346         for (size_t i = 0; i < ret.datalen; i++) {
7347                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7348         }
7349         return ret;
7350 }
7351 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7352         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7353         for (size_t i = 0; i < ret.datalen; i++) {
7354                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7355         }
7356         return ret;
7357 }
7358 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7359         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7360         for (size_t i = 0; i < ret.datalen; i++) {
7361                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7362         }
7363         return ret;
7364 }
7365 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7366         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7367         for (size_t i = 0; i < ret.datalen; i++) {
7368                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7369         }
7370         return ret;
7371 }
7372 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7373         LDKAcceptChannel ret = *owner->contents.result;
7374         ret.is_owned = false;
7375         return ret;
7376 }
7377 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7378         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7379         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7380         uint64_t ret_ref = 0;
7381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7383         return ret_ref;
7384 }
7385
7386 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7387 CHECK(!owner->result_ok);
7388         return DecodeError_clone(&*owner->contents.err);
7389 }
7390 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7391         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7392         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7393         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7394         uint64_t ret_ref = tag_ptr(ret_copy, true);
7395         return ret_ref;
7396 }
7397
7398 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
7399         LDKAcceptChannelV2 ret = *owner->contents.result;
7400         ret.is_owned = false;
7401         return ret;
7402 }
7403 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
7404         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
7405         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
7406         uint64_t ret_ref = 0;
7407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7409         return ret_ref;
7410 }
7411
7412 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
7413 CHECK(!owner->result_ok);
7414         return DecodeError_clone(&*owner->contents.err);
7415 }
7416 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
7417         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
7418         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7419         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
7420         uint64_t ret_ref = tag_ptr(ret_copy, true);
7421         return ret_ref;
7422 }
7423
7424 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
7425         LDKTxAddInput ret = *owner->contents.result;
7426         ret.is_owned = false;
7427         return ret;
7428 }
7429 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
7430         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
7431         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
7432         uint64_t ret_ref = 0;
7433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7435         return ret_ref;
7436 }
7437
7438 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
7439 CHECK(!owner->result_ok);
7440         return DecodeError_clone(&*owner->contents.err);
7441 }
7442 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
7443         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
7444         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7445         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
7446         uint64_t ret_ref = tag_ptr(ret_copy, true);
7447         return ret_ref;
7448 }
7449
7450 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
7451         LDKTxAddOutput ret = *owner->contents.result;
7452         ret.is_owned = false;
7453         return ret;
7454 }
7455 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
7456         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
7457         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
7458         uint64_t ret_ref = 0;
7459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7461         return ret_ref;
7462 }
7463
7464 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
7465 CHECK(!owner->result_ok);
7466         return DecodeError_clone(&*owner->contents.err);
7467 }
7468 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
7469         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
7470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7471         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
7472         uint64_t ret_ref = tag_ptr(ret_copy, true);
7473         return ret_ref;
7474 }
7475
7476 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
7477         LDKTxRemoveInput ret = *owner->contents.result;
7478         ret.is_owned = false;
7479         return ret;
7480 }
7481 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
7482         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
7483         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
7484         uint64_t ret_ref = 0;
7485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7487         return ret_ref;
7488 }
7489
7490 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
7491 CHECK(!owner->result_ok);
7492         return DecodeError_clone(&*owner->contents.err);
7493 }
7494 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
7495         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
7496         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7497         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
7498         uint64_t ret_ref = tag_ptr(ret_copy, true);
7499         return ret_ref;
7500 }
7501
7502 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
7503         LDKTxRemoveOutput ret = *owner->contents.result;
7504         ret.is_owned = false;
7505         return ret;
7506 }
7507 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
7508         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
7509         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
7510         uint64_t ret_ref = 0;
7511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7513         return ret_ref;
7514 }
7515
7516 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
7517 CHECK(!owner->result_ok);
7518         return DecodeError_clone(&*owner->contents.err);
7519 }
7520 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
7521         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
7522         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7523         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
7524         uint64_t ret_ref = tag_ptr(ret_copy, true);
7525         return ret_ref;
7526 }
7527
7528 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
7529         LDKTxComplete ret = *owner->contents.result;
7530         ret.is_owned = false;
7531         return ret;
7532 }
7533 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
7534         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
7535         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
7536         uint64_t ret_ref = 0;
7537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7539         return ret_ref;
7540 }
7541
7542 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
7543 CHECK(!owner->result_ok);
7544         return DecodeError_clone(&*owner->contents.err);
7545 }
7546 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
7547         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
7548         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7549         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
7550         uint64_t ret_ref = tag_ptr(ret_copy, true);
7551         return ret_ref;
7552 }
7553
7554 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
7555         LDKTxSignatures ret = *owner->contents.result;
7556         ret.is_owned = false;
7557         return ret;
7558 }
7559 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7560         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
7561         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
7562         uint64_t ret_ref = 0;
7563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7565         return ret_ref;
7566 }
7567
7568 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
7569 CHECK(!owner->result_ok);
7570         return DecodeError_clone(&*owner->contents.err);
7571 }
7572 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7573         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
7574         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7575         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
7576         uint64_t ret_ref = tag_ptr(ret_copy, true);
7577         return ret_ref;
7578 }
7579
7580 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
7581         LDKTxInitRbf ret = *owner->contents.result;
7582         ret.is_owned = false;
7583         return ret;
7584 }
7585 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
7586         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
7587         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
7588         uint64_t ret_ref = 0;
7589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7591         return ret_ref;
7592 }
7593
7594 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
7595 CHECK(!owner->result_ok);
7596         return DecodeError_clone(&*owner->contents.err);
7597 }
7598 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
7599         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
7600         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7601         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
7602         uint64_t ret_ref = tag_ptr(ret_copy, true);
7603         return ret_ref;
7604 }
7605
7606 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
7607         LDKTxAckRbf ret = *owner->contents.result;
7608         ret.is_owned = false;
7609         return ret;
7610 }
7611 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
7612         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
7613         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
7614         uint64_t ret_ref = 0;
7615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7617         return ret_ref;
7618 }
7619
7620 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
7621 CHECK(!owner->result_ok);
7622         return DecodeError_clone(&*owner->contents.err);
7623 }
7624 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
7625         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
7626         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7627         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
7628         uint64_t ret_ref = tag_ptr(ret_copy, true);
7629         return ret_ref;
7630 }
7631
7632 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
7633         LDKTxAbort ret = *owner->contents.result;
7634         ret.is_owned = false;
7635         return ret;
7636 }
7637 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
7638         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
7639         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
7640         uint64_t ret_ref = 0;
7641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7643         return ret_ref;
7644 }
7645
7646 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
7647 CHECK(!owner->result_ok);
7648         return DecodeError_clone(&*owner->contents.err);
7649 }
7650 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
7651         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
7652         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7653         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
7654         uint64_t ret_ref = tag_ptr(ret_copy, true);
7655         return ret_ref;
7656 }
7657
7658 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7659         LDKAnnouncementSignatures ret = *owner->contents.result;
7660         ret.is_owned = false;
7661         return ret;
7662 }
7663 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7664         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7665         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7666         uint64_t ret_ref = 0;
7667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7669         return ret_ref;
7670 }
7671
7672 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7673 CHECK(!owner->result_ok);
7674         return DecodeError_clone(&*owner->contents.err);
7675 }
7676 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7677         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7678         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7679         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7680         uint64_t ret_ref = tag_ptr(ret_copy, true);
7681         return ret_ref;
7682 }
7683
7684 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7685         LDKChannelReestablish ret = *owner->contents.result;
7686         ret.is_owned = false;
7687         return ret;
7688 }
7689 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7690         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7691         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7692         uint64_t ret_ref = 0;
7693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7695         return ret_ref;
7696 }
7697
7698 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7699 CHECK(!owner->result_ok);
7700         return DecodeError_clone(&*owner->contents.err);
7701 }
7702 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7703         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7704         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7705         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7706         uint64_t ret_ref = tag_ptr(ret_copy, true);
7707         return ret_ref;
7708 }
7709
7710 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7711         LDKClosingSigned ret = *owner->contents.result;
7712         ret.is_owned = false;
7713         return ret;
7714 }
7715 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7716         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7717         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7718         uint64_t ret_ref = 0;
7719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7721         return ret_ref;
7722 }
7723
7724 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7725 CHECK(!owner->result_ok);
7726         return DecodeError_clone(&*owner->contents.err);
7727 }
7728 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7729         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7730         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7731         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7732         uint64_t ret_ref = tag_ptr(ret_copy, true);
7733         return ret_ref;
7734 }
7735
7736 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7737         LDKClosingSignedFeeRange ret = *owner->contents.result;
7738         ret.is_owned = false;
7739         return ret;
7740 }
7741 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7742         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7743         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7744         uint64_t ret_ref = 0;
7745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7747         return ret_ref;
7748 }
7749
7750 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7751 CHECK(!owner->result_ok);
7752         return DecodeError_clone(&*owner->contents.err);
7753 }
7754 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7755         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7756         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7757         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7758         uint64_t ret_ref = tag_ptr(ret_copy, true);
7759         return ret_ref;
7760 }
7761
7762 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7763         LDKCommitmentSigned ret = *owner->contents.result;
7764         ret.is_owned = false;
7765         return ret;
7766 }
7767 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7768         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7769         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7770         uint64_t ret_ref = 0;
7771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7773         return ret_ref;
7774 }
7775
7776 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7777 CHECK(!owner->result_ok);
7778         return DecodeError_clone(&*owner->contents.err);
7779 }
7780 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7781         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7782         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7783         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7784         uint64_t ret_ref = tag_ptr(ret_copy, true);
7785         return ret_ref;
7786 }
7787
7788 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7789         LDKFundingCreated ret = *owner->contents.result;
7790         ret.is_owned = false;
7791         return ret;
7792 }
7793 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7794         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7795         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7796         uint64_t ret_ref = 0;
7797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7799         return ret_ref;
7800 }
7801
7802 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7803 CHECK(!owner->result_ok);
7804         return DecodeError_clone(&*owner->contents.err);
7805 }
7806 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7807         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7808         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7809         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7810         uint64_t ret_ref = tag_ptr(ret_copy, true);
7811         return ret_ref;
7812 }
7813
7814 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7815         LDKFundingSigned ret = *owner->contents.result;
7816         ret.is_owned = false;
7817         return ret;
7818 }
7819 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7820         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7821         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7822         uint64_t ret_ref = 0;
7823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7825         return ret_ref;
7826 }
7827
7828 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7829 CHECK(!owner->result_ok);
7830         return DecodeError_clone(&*owner->contents.err);
7831 }
7832 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7833         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7834         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7835         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7836         uint64_t ret_ref = tag_ptr(ret_copy, true);
7837         return ret_ref;
7838 }
7839
7840 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7841         LDKChannelReady ret = *owner->contents.result;
7842         ret.is_owned = false;
7843         return ret;
7844 }
7845 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7846         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7847         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7848         uint64_t ret_ref = 0;
7849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7851         return ret_ref;
7852 }
7853
7854 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7855 CHECK(!owner->result_ok);
7856         return DecodeError_clone(&*owner->contents.err);
7857 }
7858 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7859         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7860         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7861         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7862         uint64_t ret_ref = tag_ptr(ret_copy, true);
7863         return ret_ref;
7864 }
7865
7866 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7867         LDKInit ret = *owner->contents.result;
7868         ret.is_owned = false;
7869         return ret;
7870 }
7871 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7872         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7873         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7874         uint64_t ret_ref = 0;
7875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7877         return ret_ref;
7878 }
7879
7880 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7881 CHECK(!owner->result_ok);
7882         return DecodeError_clone(&*owner->contents.err);
7883 }
7884 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7885         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7886         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7887         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7888         uint64_t ret_ref = tag_ptr(ret_copy, true);
7889         return ret_ref;
7890 }
7891
7892 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7893         LDKOpenChannel ret = *owner->contents.result;
7894         ret.is_owned = false;
7895         return ret;
7896 }
7897 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7898         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7899         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7900         uint64_t ret_ref = 0;
7901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7903         return ret_ref;
7904 }
7905
7906 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7907 CHECK(!owner->result_ok);
7908         return DecodeError_clone(&*owner->contents.err);
7909 }
7910 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7911         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7912         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7913         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7914         uint64_t ret_ref = tag_ptr(ret_copy, true);
7915         return ret_ref;
7916 }
7917
7918 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
7919         LDKOpenChannelV2 ret = *owner->contents.result;
7920         ret.is_owned = false;
7921         return ret;
7922 }
7923 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
7924         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
7925         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
7926         uint64_t ret_ref = 0;
7927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7929         return ret_ref;
7930 }
7931
7932 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
7933 CHECK(!owner->result_ok);
7934         return DecodeError_clone(&*owner->contents.err);
7935 }
7936 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
7937         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
7938         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7939         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
7940         uint64_t ret_ref = tag_ptr(ret_copy, true);
7941         return ret_ref;
7942 }
7943
7944 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7945         LDKRevokeAndACK ret = *owner->contents.result;
7946         ret.is_owned = false;
7947         return ret;
7948 }
7949 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7950         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7951         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7952         uint64_t ret_ref = 0;
7953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7955         return ret_ref;
7956 }
7957
7958 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7959 CHECK(!owner->result_ok);
7960         return DecodeError_clone(&*owner->contents.err);
7961 }
7962 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7963         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7964         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7965         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7966         uint64_t ret_ref = tag_ptr(ret_copy, true);
7967         return ret_ref;
7968 }
7969
7970 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7971         LDKShutdown ret = *owner->contents.result;
7972         ret.is_owned = false;
7973         return ret;
7974 }
7975 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7976         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7977         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7978         uint64_t ret_ref = 0;
7979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7981         return ret_ref;
7982 }
7983
7984 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7985 CHECK(!owner->result_ok);
7986         return DecodeError_clone(&*owner->contents.err);
7987 }
7988 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7989         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7990         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7991         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7992         uint64_t ret_ref = tag_ptr(ret_copy, true);
7993         return ret_ref;
7994 }
7995
7996 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7997         LDKUpdateFailHTLC ret = *owner->contents.result;
7998         ret.is_owned = false;
7999         return ret;
8000 }
8001 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8002         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8003         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8004         uint64_t ret_ref = 0;
8005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8007         return ret_ref;
8008 }
8009
8010 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8011 CHECK(!owner->result_ok);
8012         return DecodeError_clone(&*owner->contents.err);
8013 }
8014 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
8015         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8016         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8017         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8018         uint64_t ret_ref = tag_ptr(ret_copy, true);
8019         return ret_ref;
8020 }
8021
8022 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8023         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8024         ret.is_owned = false;
8025         return ret;
8026 }
8027 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8028         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8029         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8030         uint64_t ret_ref = 0;
8031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8033         return ret_ref;
8034 }
8035
8036 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8037 CHECK(!owner->result_ok);
8038         return DecodeError_clone(&*owner->contents.err);
8039 }
8040 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
8041         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8042         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8043         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8044         uint64_t ret_ref = tag_ptr(ret_copy, true);
8045         return ret_ref;
8046 }
8047
8048 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8049         LDKUpdateFee ret = *owner->contents.result;
8050         ret.is_owned = false;
8051         return ret;
8052 }
8053 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
8054         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8055         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8056         uint64_t ret_ref = 0;
8057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8059         return ret_ref;
8060 }
8061
8062 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8063 CHECK(!owner->result_ok);
8064         return DecodeError_clone(&*owner->contents.err);
8065 }
8066 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
8067         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8068         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8069         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8070         uint64_t ret_ref = tag_ptr(ret_copy, true);
8071         return ret_ref;
8072 }
8073
8074 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8075         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8076         ret.is_owned = false;
8077         return ret;
8078 }
8079 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8080         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8081         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8082         uint64_t ret_ref = 0;
8083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8085         return ret_ref;
8086 }
8087
8088 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8089 CHECK(!owner->result_ok);
8090         return DecodeError_clone(&*owner->contents.err);
8091 }
8092 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
8093         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8094         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8095         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8096         uint64_t ret_ref = tag_ptr(ret_copy, true);
8097         return ret_ref;
8098 }
8099
8100 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8101         LDKUpdateAddHTLC ret = *owner->contents.result;
8102         ret.is_owned = false;
8103         return ret;
8104 }
8105 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8106         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8107         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8108         uint64_t ret_ref = 0;
8109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8111         return ret_ref;
8112 }
8113
8114 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8115 CHECK(!owner->result_ok);
8116         return DecodeError_clone(&*owner->contents.err);
8117 }
8118 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
8119         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8120         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8121         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8122         uint64_t ret_ref = tag_ptr(ret_copy, true);
8123         return ret_ref;
8124 }
8125
8126 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8127         LDKOnionMessage ret = *owner->contents.result;
8128         ret.is_owned = false;
8129         return ret;
8130 }
8131 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
8132         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8133         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
8134         uint64_t ret_ref = 0;
8135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8137         return ret_ref;
8138 }
8139
8140 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8141 CHECK(!owner->result_ok);
8142         return DecodeError_clone(&*owner->contents.err);
8143 }
8144 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
8145         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8146         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8147         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
8148         uint64_t ret_ref = tag_ptr(ret_copy, true);
8149         return ret_ref;
8150 }
8151
8152 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8153         LDKPing ret = *owner->contents.result;
8154         ret.is_owned = false;
8155         return ret;
8156 }
8157 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
8158         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8159         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8160         uint64_t ret_ref = 0;
8161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8163         return ret_ref;
8164 }
8165
8166 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8167 CHECK(!owner->result_ok);
8168         return DecodeError_clone(&*owner->contents.err);
8169 }
8170 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
8171         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8172         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8173         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
8174         uint64_t ret_ref = tag_ptr(ret_copy, true);
8175         return ret_ref;
8176 }
8177
8178 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8179         LDKPong ret = *owner->contents.result;
8180         ret.is_owned = false;
8181         return ret;
8182 }
8183 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
8184         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8185         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8186         uint64_t ret_ref = 0;
8187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8189         return ret_ref;
8190 }
8191
8192 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8193 CHECK(!owner->result_ok);
8194         return DecodeError_clone(&*owner->contents.err);
8195 }
8196 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
8197         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8198         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8199         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
8200         uint64_t ret_ref = tag_ptr(ret_copy, true);
8201         return ret_ref;
8202 }
8203
8204 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8205         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8206         ret.is_owned = false;
8207         return ret;
8208 }
8209 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8210         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8211         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8212         uint64_t ret_ref = 0;
8213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8215         return ret_ref;
8216 }
8217
8218 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8219 CHECK(!owner->result_ok);
8220         return DecodeError_clone(&*owner->contents.err);
8221 }
8222 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8223         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8224         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8225         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8226         uint64_t ret_ref = tag_ptr(ret_copy, true);
8227         return ret_ref;
8228 }
8229
8230 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8231         LDKChannelAnnouncement ret = *owner->contents.result;
8232         ret.is_owned = false;
8233         return ret;
8234 }
8235 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8236         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8237         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8238         uint64_t ret_ref = 0;
8239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8241         return ret_ref;
8242 }
8243
8244 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8245 CHECK(!owner->result_ok);
8246         return DecodeError_clone(&*owner->contents.err);
8247 }
8248 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8249         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8250         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8251         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8252         uint64_t ret_ref = tag_ptr(ret_copy, true);
8253         return ret_ref;
8254 }
8255
8256 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8257         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8258         ret.is_owned = false;
8259         return ret;
8260 }
8261 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8262         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8263         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8264         uint64_t ret_ref = 0;
8265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8267         return ret_ref;
8268 }
8269
8270 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8271 CHECK(!owner->result_ok);
8272         return DecodeError_clone(&*owner->contents.err);
8273 }
8274 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8275         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8276         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8277         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8278         uint64_t ret_ref = tag_ptr(ret_copy, true);
8279         return ret_ref;
8280 }
8281
8282 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8283         LDKChannelUpdate ret = *owner->contents.result;
8284         ret.is_owned = false;
8285         return ret;
8286 }
8287 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8288         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8289         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8290         uint64_t ret_ref = 0;
8291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8293         return ret_ref;
8294 }
8295
8296 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8297 CHECK(!owner->result_ok);
8298         return DecodeError_clone(&*owner->contents.err);
8299 }
8300 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8301         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8302         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8303         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8304         uint64_t ret_ref = tag_ptr(ret_copy, true);
8305         return ret_ref;
8306 }
8307
8308 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8309         LDKErrorMessage ret = *owner->contents.result;
8310         ret.is_owned = false;
8311         return ret;
8312 }
8313 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
8314         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8315         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8316         uint64_t ret_ref = 0;
8317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8319         return ret_ref;
8320 }
8321
8322 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8323 CHECK(!owner->result_ok);
8324         return DecodeError_clone(&*owner->contents.err);
8325 }
8326 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
8327         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8328         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8329         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8330         uint64_t ret_ref = tag_ptr(ret_copy, true);
8331         return ret_ref;
8332 }
8333
8334 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8335         LDKWarningMessage ret = *owner->contents.result;
8336         ret.is_owned = false;
8337         return ret;
8338 }
8339 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
8340         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8341         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8342         uint64_t ret_ref = 0;
8343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8345         return ret_ref;
8346 }
8347
8348 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8349 CHECK(!owner->result_ok);
8350         return DecodeError_clone(&*owner->contents.err);
8351 }
8352 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
8353         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8354         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8355         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8356         uint64_t ret_ref = tag_ptr(ret_copy, true);
8357         return ret_ref;
8358 }
8359
8360 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8361         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
8362         ret.is_owned = false;
8363         return ret;
8364 }
8365 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8366         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8367         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8368         uint64_t ret_ref = 0;
8369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8371         return ret_ref;
8372 }
8373
8374 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8375 CHECK(!owner->result_ok);
8376         return DecodeError_clone(&*owner->contents.err);
8377 }
8378 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8379         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8380         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8381         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8382         uint64_t ret_ref = tag_ptr(ret_copy, true);
8383         return ret_ref;
8384 }
8385
8386 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8387         LDKNodeAnnouncement ret = *owner->contents.result;
8388         ret.is_owned = false;
8389         return ret;
8390 }
8391 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8392         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8393         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8394         uint64_t ret_ref = 0;
8395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8397         return ret_ref;
8398 }
8399
8400 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8401 CHECK(!owner->result_ok);
8402         return DecodeError_clone(&*owner->contents.err);
8403 }
8404 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8405         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8406         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8407         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8408         uint64_t ret_ref = tag_ptr(ret_copy, true);
8409         return ret_ref;
8410 }
8411
8412 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8413         LDKQueryShortChannelIds ret = *owner->contents.result;
8414         ret.is_owned = false;
8415         return ret;
8416 }
8417 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
8418         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8419         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8420         uint64_t ret_ref = 0;
8421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8423         return ret_ref;
8424 }
8425
8426 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8427 CHECK(!owner->result_ok);
8428         return DecodeError_clone(&*owner->contents.err);
8429 }
8430 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
8431         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8432         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8433         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8434         uint64_t ret_ref = tag_ptr(ret_copy, true);
8435         return ret_ref;
8436 }
8437
8438 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8439         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
8440         ret.is_owned = false;
8441         return ret;
8442 }
8443 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
8444         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8445         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8446         uint64_t ret_ref = 0;
8447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8449         return ret_ref;
8450 }
8451
8452 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8453 CHECK(!owner->result_ok);
8454         return DecodeError_clone(&*owner->contents.err);
8455 }
8456 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
8457         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8459         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8460         uint64_t ret_ref = tag_ptr(ret_copy, true);
8461         return ret_ref;
8462 }
8463
8464 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8465         LDKQueryChannelRange ret = *owner->contents.result;
8466         ret.is_owned = false;
8467         return ret;
8468 }
8469 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8470         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8471         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8472         uint64_t ret_ref = 0;
8473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8475         return ret_ref;
8476 }
8477
8478 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8479 CHECK(!owner->result_ok);
8480         return DecodeError_clone(&*owner->contents.err);
8481 }
8482 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8483         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8484         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8485         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8486         uint64_t ret_ref = tag_ptr(ret_copy, true);
8487         return ret_ref;
8488 }
8489
8490 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8491         LDKReplyChannelRange ret = *owner->contents.result;
8492         ret.is_owned = false;
8493         return ret;
8494 }
8495 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8496         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8497         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8498         uint64_t ret_ref = 0;
8499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8501         return ret_ref;
8502 }
8503
8504 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8505 CHECK(!owner->result_ok);
8506         return DecodeError_clone(&*owner->contents.err);
8507 }
8508 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8509         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8510         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8511         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8512         uint64_t ret_ref = tag_ptr(ret_copy, true);
8513         return ret_ref;
8514 }
8515
8516 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8517         LDKGossipTimestampFilter ret = *owner->contents.result;
8518         ret.is_owned = false;
8519         return ret;
8520 }
8521 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
8522         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8523         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8524         uint64_t ret_ref = 0;
8525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8527         return ret_ref;
8528 }
8529
8530 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8531 CHECK(!owner->result_ok);
8532         return DecodeError_clone(&*owner->contents.err);
8533 }
8534 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
8535         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8536         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8537         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8538         uint64_t ret_ref = tag_ptr(ret_copy, true);
8539         return ret_ref;
8540 }
8541
8542 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
8543         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
8544         for (size_t i = 0; i < ret.datalen; i++) {
8545                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
8546         }
8547         return ret;
8548 }
8549 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
8550         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8551         switch(obj->tag) {
8552                 case LDKSignOrCreationError_SignError: return 0;
8553                 case LDKSignOrCreationError_CreationError: return 1;
8554                 default: abort();
8555         }
8556 }
8557 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
8558         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8559         assert(obj->tag == LDKSignOrCreationError_CreationError);
8560                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8561         return creation_error_conv;
8562 }
8563 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8564         LDKBolt11Invoice ret = *owner->contents.result;
8565         ret.is_owned = false;
8566         return ret;
8567 }
8568 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
8569         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8570         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8571         uint64_t ret_ref = 0;
8572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8574         return ret_ref;
8575 }
8576
8577 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8578 CHECK(!owner->result_ok);
8579         return SignOrCreationError_clone(&*owner->contents.err);
8580 }
8581 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
8582         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8583         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8584         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8585         uint64_t ret_ref = tag_ptr(ret_copy, true);
8586         return ret_ref;
8587 }
8588
8589 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
8590 CHECK(owner->result_ok);
8591         return OffersMessage_clone(&*owner->contents.result);
8592 }
8593 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
8594         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
8595         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
8596         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
8597         uint64_t ret_ref = tag_ptr(ret_copy, true);
8598         return ret_ref;
8599 }
8600
8601 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
8602 CHECK(!owner->result_ok);
8603         return DecodeError_clone(&*owner->contents.err);
8604 }
8605 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
8606         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
8607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8608         *ret_copy = CResult_OffersMessageDecodeErrorZ_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_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
8614         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
8615         switch(obj->tag) {
8616                 case LDKCOption_HTLCClaimZ_Some: return 0;
8617                 case LDKCOption_HTLCClaimZ_None: return 1;
8618                 default: abort();
8619         }
8620 }
8621 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
8622         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
8623         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
8624                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
8625         return some_conv;
8626 }
8627 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
8628         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
8629         ret.is_owned = false;
8630         return ret;
8631 }
8632 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
8633         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
8634         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
8635         uint64_t ret_ref = 0;
8636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8638         return ret_ref;
8639 }
8640
8641 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
8642 CHECK(!owner->result_ok);
8643         return DecodeError_clone(&*owner->contents.err);
8644 }
8645 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
8646         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
8647         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8648         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
8649         uint64_t ret_ref = tag_ptr(ret_copy, true);
8650         return ret_ref;
8651 }
8652
8653 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
8654         LDKTxCreationKeys ret = *owner->contents.result;
8655         ret.is_owned = false;
8656         return ret;
8657 }
8658 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
8659         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
8660         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
8661         uint64_t ret_ref = 0;
8662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8664         return ret_ref;
8665 }
8666
8667 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
8668 CHECK(!owner->result_ok);
8669         return DecodeError_clone(&*owner->contents.err);
8670 }
8671 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
8672         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
8673         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8674         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
8675         uint64_t ret_ref = tag_ptr(ret_copy, true);
8676         return ret_ref;
8677 }
8678
8679 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
8680         LDKChannelPublicKeys ret = *owner->contents.result;
8681         ret.is_owned = false;
8682         return ret;
8683 }
8684 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
8685         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
8686         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
8687         uint64_t ret_ref = 0;
8688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8690         return ret_ref;
8691 }
8692
8693 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
8694 CHECK(!owner->result_ok);
8695         return DecodeError_clone(&*owner->contents.err);
8696 }
8697 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
8698         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
8699         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8700         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
8701         uint64_t ret_ref = tag_ptr(ret_copy, true);
8702         return ret_ref;
8703 }
8704
8705 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
8706         LDKHTLCOutputInCommitment ret = *owner->contents.result;
8707         ret.is_owned = false;
8708         return ret;
8709 }
8710 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
8711         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
8712         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
8713         uint64_t ret_ref = 0;
8714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8716         return ret_ref;
8717 }
8718
8719 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
8720 CHECK(!owner->result_ok);
8721         return DecodeError_clone(&*owner->contents.err);
8722 }
8723 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
8724         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
8725         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8726         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
8727         uint64_t ret_ref = tag_ptr(ret_copy, true);
8728         return ret_ref;
8729 }
8730
8731 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8732         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
8733         ret.is_owned = false;
8734         return ret;
8735 }
8736 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
8737         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8738         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
8739         uint64_t ret_ref = 0;
8740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8742         return ret_ref;
8743 }
8744
8745 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8746 CHECK(!owner->result_ok);
8747         return DecodeError_clone(&*owner->contents.err);
8748 }
8749 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
8750         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8751         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8752         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
8753         uint64_t ret_ref = tag_ptr(ret_copy, true);
8754         return ret_ref;
8755 }
8756
8757 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8758         LDKChannelTransactionParameters ret = *owner->contents.result;
8759         ret.is_owned = false;
8760         return ret;
8761 }
8762 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
8763         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8764         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
8765         uint64_t ret_ref = 0;
8766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8768         return ret_ref;
8769 }
8770
8771 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8772 CHECK(!owner->result_ok);
8773         return DecodeError_clone(&*owner->contents.err);
8774 }
8775 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
8776         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8777         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8778         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
8779         uint64_t ret_ref = tag_ptr(ret_copy, true);
8780         return ret_ref;
8781 }
8782
8783 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8784         LDKHolderCommitmentTransaction ret = *owner->contents.result;
8785         ret.is_owned = false;
8786         return ret;
8787 }
8788 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8789         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8790         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8791         uint64_t ret_ref = 0;
8792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8794         return ret_ref;
8795 }
8796
8797 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8798 CHECK(!owner->result_ok);
8799         return DecodeError_clone(&*owner->contents.err);
8800 }
8801 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8802         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8803         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8804         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8805         uint64_t ret_ref = tag_ptr(ret_copy, true);
8806         return ret_ref;
8807 }
8808
8809 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8810         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
8811         ret.is_owned = false;
8812         return ret;
8813 }
8814 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8815         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8816         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8817         uint64_t ret_ref = 0;
8818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8820         return ret_ref;
8821 }
8822
8823 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8824 CHECK(!owner->result_ok);
8825         return DecodeError_clone(&*owner->contents.err);
8826 }
8827 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8828         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8829         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8830         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8831         uint64_t ret_ref = tag_ptr(ret_copy, true);
8832         return ret_ref;
8833 }
8834
8835 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
8836         LDKTrustedClosingTransaction ret = *owner->contents.result;
8837         ret.is_owned = false;
8838         return ret;
8839 }
8840 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
8841         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
8842         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
8843         uint64_t ret_ref = 0;
8844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8846         return ret_ref;
8847 }
8848
8849 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
8850 CHECK(!owner->result_ok);
8851         return *owner->contents.err;
8852 }
8853 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
8854         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
8855         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
8856 }
8857
8858 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8859         LDKCommitmentTransaction ret = *owner->contents.result;
8860         ret.is_owned = false;
8861         return ret;
8862 }
8863 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8864         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8865         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8866         uint64_t ret_ref = 0;
8867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8869         return ret_ref;
8870 }
8871
8872 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8873 CHECK(!owner->result_ok);
8874         return DecodeError_clone(&*owner->contents.err);
8875 }
8876 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8877         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8878         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8879         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8880         uint64_t ret_ref = tag_ptr(ret_copy, true);
8881         return ret_ref;
8882 }
8883
8884 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
8885         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
8886         ret.is_owned = false;
8887         return ret;
8888 }
8889 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
8890         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
8891         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
8892         uint64_t ret_ref = 0;
8893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8895         return ret_ref;
8896 }
8897
8898 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
8899 CHECK(!owner->result_ok);
8900         return *owner->contents.err;
8901 }
8902 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
8903         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
8904         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
8905 }
8906
8907 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
8908 CHECK(owner->result_ok);
8909         return *owner->contents.result;
8910 }
8911 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
8912         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
8913         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
8914         ptrArray ret_arr = NULL;
8915         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8916         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
8917         for (size_t m = 0; m < ret_var.datalen; m++) {
8918                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
8919                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
8920                 ret_arr_ptr[m] = ret_conv_12_arr;
8921         }
8922         
8923         return ret_arr;
8924 }
8925
8926 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
8927 CHECK(!owner->result_ok);
8928         return *owner->contents.err;
8929 }
8930 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
8931         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
8932         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
8933 }
8934
8935 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
8936         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
8937         switch(obj->tag) {
8938                 case LDKCOption_usizeZ_Some: return 0;
8939                 case LDKCOption_usizeZ_None: return 1;
8940                 default: abort();
8941         }
8942 }
8943 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
8944         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
8945         assert(obj->tag == LDKCOption_usizeZ_Some);
8946                         uint32_t some_conv = obj->some;
8947         return some_conv;
8948 }
8949 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
8950         LDKShutdownScript ret = *owner->contents.result;
8951         ret.is_owned = false;
8952         return ret;
8953 }
8954 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
8955         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
8956         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
8957         uint64_t ret_ref = 0;
8958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8960         return ret_ref;
8961 }
8962
8963 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
8964 CHECK(!owner->result_ok);
8965         return DecodeError_clone(&*owner->contents.err);
8966 }
8967 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
8968         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
8969         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8970         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
8971         uint64_t ret_ref = tag_ptr(ret_copy, true);
8972         return ret_ref;
8973 }
8974
8975 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
8976         LDKShutdownScript ret = *owner->contents.result;
8977         ret.is_owned = false;
8978         return ret;
8979 }
8980 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
8981         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
8982         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
8983         uint64_t ret_ref = 0;
8984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8986         return ret_ref;
8987 }
8988
8989 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
8990         LDKInvalidShutdownScript ret = *owner->contents.err;
8991         ret.is_owned = false;
8992         return ret;
8993 }
8994 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
8995         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
8996         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(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 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
9004         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9005         switch(obj->tag) {
9006                 case LDKPaymentPurpose_InvoicePayment: return 0;
9007                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
9008                 default: abort();
9009         }
9010 }
9011 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
9012         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9013         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9014                         uint64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
9015         return payment_preimage_ref;
9016 }
9017 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
9018         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9019         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9020                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
9021                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
9022         return payment_secret_arr;
9023 }
9024 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
9025         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9026         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
9027                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
9028                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
9029         return spontaneous_payment_arr;
9030 }
9031 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9032 CHECK(owner->result_ok);
9033         return PaymentPurpose_clone(&*owner->contents.result);
9034 }
9035 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
9036         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9037         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
9038         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
9039         uint64_t ret_ref = tag_ptr(ret_copy, true);
9040         return ret_ref;
9041 }
9042
9043 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9044 CHECK(!owner->result_ok);
9045         return DecodeError_clone(&*owner->contents.err);
9046 }
9047 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
9048         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9049         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9050         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
9051         uint64_t ret_ref = tag_ptr(ret_copy, true);
9052         return ret_ref;
9053 }
9054
9055 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
9056         LDKClaimedHTLC ret = *owner->contents.result;
9057         ret.is_owned = false;
9058         return ret;
9059 }
9060 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9061         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
9062         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
9063         uint64_t ret_ref = 0;
9064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9066         return ret_ref;
9067 }
9068
9069 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
9070 CHECK(!owner->result_ok);
9071         return DecodeError_clone(&*owner->contents.err);
9072 }
9073 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9074         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
9075         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9076         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
9077         uint64_t ret_ref = tag_ptr(ret_copy, true);
9078         return ret_ref;
9079 }
9080
9081 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
9082         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9083         switch(obj->tag) {
9084                 case LDKPathFailure_InitialSend: return 0;
9085                 case LDKPathFailure_OnPath: return 1;
9086                 default: abort();
9087         }
9088 }
9089 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
9090         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9091         assert(obj->tag == LDKPathFailure_InitialSend);
9092                         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
9093         return err_ref;
9094 }
9095 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
9096         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9097         assert(obj->tag == LDKPathFailure_OnPath);
9098                         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
9099         return network_update_ref;
9100 }
9101 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
9102         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
9103         switch(obj->tag) {
9104                 case LDKCOption_PathFailureZ_Some: return 0;
9105                 case LDKCOption_PathFailureZ_None: return 1;
9106                 default: abort();
9107         }
9108 }
9109 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
9110         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
9111         assert(obj->tag == LDKCOption_PathFailureZ_Some);
9112                         uint64_t some_ref = tag_ptr(&obj->some, false);
9113         return some_ref;
9114 }
9115 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
9116 CHECK(owner->result_ok);
9117         return COption_PathFailureZ_clone(&*owner->contents.result);
9118 }
9119 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
9120         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
9121         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
9122         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
9123         uint64_t ret_ref = tag_ptr(ret_copy, true);
9124         return ret_ref;
9125 }
9126
9127 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
9128 CHECK(!owner->result_ok);
9129         return DecodeError_clone(&*owner->contents.err);
9130 }
9131 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
9132         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
9133         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9134         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
9135         uint64_t ret_ref = tag_ptr(ret_copy, true);
9136         return ret_ref;
9137 }
9138
9139 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
9140         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9141         switch(obj->tag) {
9142                 case LDKClosureReason_CounterpartyForceClosed: return 0;
9143                 case LDKClosureReason_HolderForceClosed: return 1;
9144                 case LDKClosureReason_CooperativeClosure: return 2;
9145                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
9146                 case LDKClosureReason_FundingTimedOut: return 4;
9147                 case LDKClosureReason_ProcessingError: return 5;
9148                 case LDKClosureReason_DisconnectedPeer: return 6;
9149                 case LDKClosureReason_OutdatedChannelManager: return 7;
9150                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
9151                 case LDKClosureReason_FundingBatchClosure: return 9;
9152                 default: abort();
9153         }
9154 }
9155 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
9156         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9157         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
9158                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
9159                         uint64_t peer_msg_ref = 0;
9160                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
9161                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
9162         return peer_msg_ref;
9163 }
9164 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
9165         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9166         assert(obj->tag == LDKClosureReason_ProcessingError);
9167                         LDKStr err_str = obj->processing_error.err;
9168                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
9169         return err_conv;
9170 }
9171 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
9172         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
9173         switch(obj->tag) {
9174                 case LDKCOption_ClosureReasonZ_Some: return 0;
9175                 case LDKCOption_ClosureReasonZ_None: return 1;
9176                 default: abort();
9177         }
9178 }
9179 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
9180         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
9181         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
9182                         uint64_t some_ref = tag_ptr(&obj->some, false);
9183         return some_ref;
9184 }
9185 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
9186 CHECK(owner->result_ok);
9187         return COption_ClosureReasonZ_clone(&*owner->contents.result);
9188 }
9189 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
9190         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
9191         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9192         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
9193         uint64_t ret_ref = tag_ptr(ret_copy, true);
9194         return ret_ref;
9195 }
9196
9197 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
9198 CHECK(!owner->result_ok);
9199         return DecodeError_clone(&*owner->contents.err);
9200 }
9201 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
9202         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
9203         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9204         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
9205         uint64_t ret_ref = tag_ptr(ret_copy, true);
9206         return ret_ref;
9207 }
9208
9209 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
9210         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9211         switch(obj->tag) {
9212                 case LDKHTLCDestination_NextHopChannel: return 0;
9213                 case LDKHTLCDestination_UnknownNextHop: return 1;
9214                 case LDKHTLCDestination_InvalidForward: return 2;
9215                 case LDKHTLCDestination_FailedPayment: return 3;
9216                 default: abort();
9217         }
9218 }
9219 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
9220         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9221         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
9222                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
9223                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
9224         return node_id_arr;
9225 }
9226 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
9227         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9228         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
9229                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9230                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
9231         return channel_id_arr;
9232 }
9233 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
9234         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9235         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
9236                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
9237         return requested_forward_scid_conv;
9238 }
9239 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
9240         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9241         assert(obj->tag == LDKHTLCDestination_InvalidForward);
9242                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
9243         return requested_forward_scid_conv;
9244 }
9245 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
9246         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9247         assert(obj->tag == LDKHTLCDestination_FailedPayment);
9248                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9249                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
9250         return payment_hash_arr;
9251 }
9252 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
9253         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
9254         switch(obj->tag) {
9255                 case LDKCOption_HTLCDestinationZ_Some: return 0;
9256                 case LDKCOption_HTLCDestinationZ_None: return 1;
9257                 default: abort();
9258         }
9259 }
9260 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
9261         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
9262         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
9263                         uint64_t some_ref = tag_ptr(&obj->some, false);
9264         return some_ref;
9265 }
9266 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
9267 CHECK(owner->result_ok);
9268         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
9269 }
9270 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
9271         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
9272         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
9273         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
9274         uint64_t ret_ref = tag_ptr(ret_copy, true);
9275         return ret_ref;
9276 }
9277
9278 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
9279 CHECK(!owner->result_ok);
9280         return DecodeError_clone(&*owner->contents.err);
9281 }
9282 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
9283         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
9284         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9285         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
9286         uint64_t ret_ref = tag_ptr(ret_copy, true);
9287         return ret_ref;
9288 }
9289
9290 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
9291 CHECK(owner->result_ok);
9292         return PaymentFailureReason_clone(&*owner->contents.result);
9293 }
9294 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
9295         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
9296         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
9297         return ret_conv;
9298 }
9299
9300 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
9301 CHECK(!owner->result_ok);
9302         return DecodeError_clone(&*owner->contents.err);
9303 }
9304 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
9305         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
9306         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9307         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
9308         uint64_t ret_ref = tag_ptr(ret_copy, true);
9309         return ret_ref;
9310 }
9311
9312 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
9313         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
9314         switch(obj->tag) {
9315                 case LDKCOption_U128Z_Some: return 0;
9316                 case LDKCOption_U128Z_None: return 1;
9317                 default: abort();
9318         }
9319 }
9320 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
9321         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
9322         assert(obj->tag == LDKCOption_U128Z_Some);
9323                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
9324                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
9325         return some_arr;
9326 }
9327 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
9328         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
9329         for (size_t i = 0; i < ret.datalen; i++) {
9330                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
9331         }
9332         return ret;
9333 }
9334 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
9335         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
9336         switch(obj->tag) {
9337                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
9338                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
9339                 default: abort();
9340         }
9341 }
9342 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
9343         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
9344         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
9345                         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
9346         return some_conv;
9347 }
9348 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
9349         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9350         switch(obj->tag) {
9351                 case LDKBumpTransactionEvent_ChannelClose: return 0;
9352                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
9353                 default: abort();
9354         }
9355 }
9356 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
9357         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9358         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9359                         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
9360                         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
9361         return claim_id_arr;
9362 }
9363 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) {
9364         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9365         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9366                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
9367         return package_target_feerate_sat_per_1000_weight_conv;
9368 }
9369 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
9370         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9371         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9372                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
9373                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
9374                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
9375         return commitment_tx_arr;
9376 }
9377 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
9378         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9379         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9380                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
9381         return commitment_tx_fee_satoshis_conv;
9382 }
9383 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
9384         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9385         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9386                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
9387                         uint64_t anchor_descriptor_ref = 0;
9388                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
9389                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
9390         return anchor_descriptor_ref;
9391 }
9392 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
9393         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9394         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9395                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
9396                         uint64_tArray pending_htlcs_arr = NULL;
9397                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
9398                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
9399                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
9400                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
9401                                 uint64_t pending_htlcs_conv_24_ref = 0;
9402                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
9403                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
9404                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
9405                         }
9406                         
9407         return pending_htlcs_arr;
9408 }
9409 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
9410         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9411         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9412                         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
9413                         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
9414         return claim_id_arr;
9415 }
9416 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) {
9417         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9418         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9419                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
9420         return target_feerate_sat_per_1000_weight_conv;
9421 }
9422 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
9423         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9424         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9425                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
9426                         uint64_tArray htlc_descriptors_arr = NULL;
9427                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
9428                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
9429                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
9430                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
9431                                 uint64_t htlc_descriptors_conv_16_ref = 0;
9432                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
9433                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
9434                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
9435                         }
9436                         
9437         return htlc_descriptors_arr;
9438 }
9439 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
9440         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9441         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9442                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
9443         return tx_lock_time_conv;
9444 }
9445 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
9446         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9447         switch(obj->tag) {
9448                 case LDKEvent_FundingGenerationReady: return 0;
9449                 case LDKEvent_PaymentClaimable: return 1;
9450                 case LDKEvent_PaymentClaimed: return 2;
9451                 case LDKEvent_PaymentSent: return 3;
9452                 case LDKEvent_PaymentFailed: return 4;
9453                 case LDKEvent_PaymentPathSuccessful: return 5;
9454                 case LDKEvent_PaymentPathFailed: return 6;
9455                 case LDKEvent_ProbeSuccessful: return 7;
9456                 case LDKEvent_ProbeFailed: return 8;
9457                 case LDKEvent_PendingHTLCsForwardable: return 9;
9458                 case LDKEvent_HTLCIntercepted: return 10;
9459                 case LDKEvent_SpendableOutputs: return 11;
9460                 case LDKEvent_PaymentForwarded: return 12;
9461                 case LDKEvent_ChannelPending: return 13;
9462                 case LDKEvent_ChannelReady: return 14;
9463                 case LDKEvent_ChannelClosed: return 15;
9464                 case LDKEvent_DiscardFunding: return 16;
9465                 case LDKEvent_OpenChannelRequest: return 17;
9466                 case LDKEvent_HTLCHandlingFailed: return 18;
9467                 case LDKEvent_BumpTransaction: return 19;
9468                 default: abort();
9469         }
9470 }
9471 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
9472         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9473         assert(obj->tag == LDKEvent_FundingGenerationReady);
9474                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
9475                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
9476         return temporary_channel_id_arr;
9477 }
9478 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
9479         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9480         assert(obj->tag == LDKEvent_FundingGenerationReady);
9481                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9482                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
9483         return counterparty_node_id_arr;
9484 }
9485 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
9486         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9487         assert(obj->tag == LDKEvent_FundingGenerationReady);
9488                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
9489         return channel_value_satoshis_conv;
9490 }
9491 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
9492         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9493         assert(obj->tag == LDKEvent_FundingGenerationReady);
9494                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
9495                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
9496                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
9497         return output_script_arr;
9498 }
9499 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
9500         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9501         assert(obj->tag == LDKEvent_FundingGenerationReady);
9502                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9503                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
9504         return user_channel_id_arr;
9505 }
9506 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
9507         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9508         assert(obj->tag == LDKEvent_PaymentClaimable);
9509                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
9510                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
9511         return receiver_node_id_arr;
9512 }
9513 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
9514         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9515         assert(obj->tag == LDKEvent_PaymentClaimable);
9516                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9517                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
9518         return payment_hash_arr;
9519 }
9520 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
9521         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9522         assert(obj->tag == LDKEvent_PaymentClaimable);
9523                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
9524                         uint64_t onion_fields_ref = 0;
9525                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
9526                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
9527         return onion_fields_ref;
9528 }
9529 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
9530         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9531         assert(obj->tag == LDKEvent_PaymentClaimable);
9532                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
9533         return amount_msat_conv;
9534 }
9535 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
9536         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9537         assert(obj->tag == LDKEvent_PaymentClaimable);
9538                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
9539         return counterparty_skimmed_fee_msat_conv;
9540 }
9541 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
9542         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9543         assert(obj->tag == LDKEvent_PaymentClaimable);
9544                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
9545         return purpose_ref;
9546 }
9547 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
9548         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9549         assert(obj->tag == LDKEvent_PaymentClaimable);
9550                         uint64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
9551         return via_channel_id_ref;
9552 }
9553 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
9554         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9555         assert(obj->tag == LDKEvent_PaymentClaimable);
9556                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
9557         return via_user_channel_id_ref;
9558 }
9559 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
9560         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9561         assert(obj->tag == LDKEvent_PaymentClaimable);
9562                         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
9563         return claim_deadline_ref;
9564 }
9565 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
9566         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9567         assert(obj->tag == LDKEvent_PaymentClaimed);
9568                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
9569                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
9570         return receiver_node_id_arr;
9571 }
9572 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
9573         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9574         assert(obj->tag == LDKEvent_PaymentClaimed);
9575                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9576                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
9577         return payment_hash_arr;
9578 }
9579 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
9580         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9581         assert(obj->tag == LDKEvent_PaymentClaimed);
9582                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
9583         return amount_msat_conv;
9584 }
9585 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
9586         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9587         assert(obj->tag == LDKEvent_PaymentClaimed);
9588                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
9589         return purpose_ref;
9590 }
9591 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
9592         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9593         assert(obj->tag == LDKEvent_PaymentClaimed);
9594                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
9595                         uint64_tArray htlcs_arr = NULL;
9596                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
9597                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
9598                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
9599                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
9600                                 uint64_t htlcs_conv_13_ref = 0;
9601                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
9602                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
9603                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
9604                         }
9605                         
9606         return htlcs_arr;
9607 }
9608 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
9609         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9610         assert(obj->tag == LDKEvent_PaymentClaimed);
9611                         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
9612         return sender_intended_total_msat_ref;
9613 }
9614 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
9615         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9616         assert(obj->tag == LDKEvent_PaymentSent);
9617                         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
9618         return payment_id_ref;
9619 }
9620 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
9621         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9622         assert(obj->tag == LDKEvent_PaymentSent);
9623                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
9624                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
9625         return payment_preimage_arr;
9626 }
9627 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
9628         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9629         assert(obj->tag == LDKEvent_PaymentSent);
9630                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9631                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
9632         return payment_hash_arr;
9633 }
9634 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
9635         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9636         assert(obj->tag == LDKEvent_PaymentSent);
9637                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
9638         return fee_paid_msat_ref;
9639 }
9640 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
9641         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9642         assert(obj->tag == LDKEvent_PaymentFailed);
9643                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9644                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
9645         return payment_id_arr;
9646 }
9647 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
9648         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9649         assert(obj->tag == LDKEvent_PaymentFailed);
9650                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9651                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
9652         return payment_hash_arr;
9653 }
9654 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
9655         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9656         assert(obj->tag == LDKEvent_PaymentFailed);
9657                         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
9658         return reason_ref;
9659 }
9660 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
9661         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9662         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9663                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9664                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
9665         return payment_id_arr;
9666 }
9667 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
9668         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9669         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9670                         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
9671         return payment_hash_ref;
9672 }
9673 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
9674         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9675         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9676                         LDKPath path_var = obj->payment_path_successful.path;
9677                         uint64_t path_ref = 0;
9678                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9679                         path_ref = tag_ptr(path_var.inner, false);
9680         return path_ref;
9681 }
9682 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
9683         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9684         assert(obj->tag == LDKEvent_PaymentPathFailed);
9685                         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
9686         return payment_id_ref;
9687 }
9688 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
9689         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9690         assert(obj->tag == LDKEvent_PaymentPathFailed);
9691                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9692                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
9693         return payment_hash_arr;
9694 }
9695 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
9696         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9697         assert(obj->tag == LDKEvent_PaymentPathFailed);
9698                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
9699         return payment_failed_permanently_conv;
9700 }
9701 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
9702         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9703         assert(obj->tag == LDKEvent_PaymentPathFailed);
9704                         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
9705         return failure_ref;
9706 }
9707 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
9708         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9709         assert(obj->tag == LDKEvent_PaymentPathFailed);
9710                         LDKPath path_var = obj->payment_path_failed.path;
9711                         uint64_t path_ref = 0;
9712                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9713                         path_ref = tag_ptr(path_var.inner, false);
9714         return path_ref;
9715 }
9716 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
9717         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9718         assert(obj->tag == LDKEvent_PaymentPathFailed);
9719                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
9720         return short_channel_id_ref;
9721 }
9722 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
9723         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9724         assert(obj->tag == LDKEvent_ProbeSuccessful);
9725                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9726                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
9727         return payment_id_arr;
9728 }
9729 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
9730         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9731         assert(obj->tag == LDKEvent_ProbeSuccessful);
9732                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9733                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
9734         return payment_hash_arr;
9735 }
9736 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
9737         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9738         assert(obj->tag == LDKEvent_ProbeSuccessful);
9739                         LDKPath path_var = obj->probe_successful.path;
9740                         uint64_t path_ref = 0;
9741                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9742                         path_ref = tag_ptr(path_var.inner, false);
9743         return path_ref;
9744 }
9745 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
9746         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9747         assert(obj->tag == LDKEvent_ProbeFailed);
9748                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9749                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
9750         return payment_id_arr;
9751 }
9752 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
9753         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9754         assert(obj->tag == LDKEvent_ProbeFailed);
9755                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9756                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
9757         return payment_hash_arr;
9758 }
9759 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
9760         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9761         assert(obj->tag == LDKEvent_ProbeFailed);
9762                         LDKPath path_var = obj->probe_failed.path;
9763                         uint64_t path_ref = 0;
9764                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9765                         path_ref = tag_ptr(path_var.inner, false);
9766         return path_ref;
9767 }
9768 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
9769         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9770         assert(obj->tag == LDKEvent_ProbeFailed);
9771                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
9772         return short_channel_id_ref;
9773 }
9774 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
9775         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9776         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
9777                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
9778         return time_forwardable_conv;
9779 }
9780 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
9781         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9782         assert(obj->tag == LDKEvent_HTLCIntercepted);
9783                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
9784                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
9785         return intercept_id_arr;
9786 }
9787 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
9788         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9789         assert(obj->tag == LDKEvent_HTLCIntercepted);
9790                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
9791         return requested_next_hop_scid_conv;
9792 }
9793 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
9794         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9795         assert(obj->tag == LDKEvent_HTLCIntercepted);
9796                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9797                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
9798         return payment_hash_arr;
9799 }
9800 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
9801         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9802         assert(obj->tag == LDKEvent_HTLCIntercepted);
9803                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
9804         return inbound_amount_msat_conv;
9805 }
9806 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
9807         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9808         assert(obj->tag == LDKEvent_HTLCIntercepted);
9809                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
9810         return expected_outbound_amount_msat_conv;
9811 }
9812 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
9813         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9814         assert(obj->tag == LDKEvent_SpendableOutputs);
9815                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
9816                         uint64_tArray outputs_arr = NULL;
9817                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
9818                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
9819                         for (size_t b = 0; b < outputs_var.datalen; b++) {
9820                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
9821                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
9822                         }
9823                         
9824         return outputs_arr;
9825 }
9826 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
9827         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9828         assert(obj->tag == LDKEvent_SpendableOutputs);
9829                         uint64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
9830         return channel_id_ref;
9831 }
9832 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
9833         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9834         assert(obj->tag == LDKEvent_PaymentForwarded);
9835                         uint64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
9836         return prev_channel_id_ref;
9837 }
9838 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
9839         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9840         assert(obj->tag == LDKEvent_PaymentForwarded);
9841                         uint64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
9842         return next_channel_id_ref;
9843 }
9844 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
9845         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9846         assert(obj->tag == LDKEvent_PaymentForwarded);
9847                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
9848         return fee_earned_msat_ref;
9849 }
9850 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
9851         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9852         assert(obj->tag == LDKEvent_PaymentForwarded);
9853                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
9854         return claim_from_onchain_tx_conv;
9855 }
9856 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
9857         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9858         assert(obj->tag == LDKEvent_PaymentForwarded);
9859                         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
9860         return outbound_amount_forwarded_msat_ref;
9861 }
9862 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
9863         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9864         assert(obj->tag == LDKEvent_ChannelPending);
9865                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9866                         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
9867         return channel_id_arr;
9868 }
9869 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
9870         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9871         assert(obj->tag == LDKEvent_ChannelPending);
9872                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9873                         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
9874         return user_channel_id_arr;
9875 }
9876 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
9877         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9878         assert(obj->tag == LDKEvent_ChannelPending);
9879                         uint64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
9880         return former_temporary_channel_id_ref;
9881 }
9882 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
9883         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9884         assert(obj->tag == LDKEvent_ChannelPending);
9885                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9886                         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
9887         return counterparty_node_id_arr;
9888 }
9889 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
9890         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9891         assert(obj->tag == LDKEvent_ChannelPending);
9892                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
9893                         uint64_t funding_txo_ref = 0;
9894                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
9895                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
9896         return funding_txo_ref;
9897 }
9898 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
9899         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9900         assert(obj->tag == LDKEvent_ChannelReady);
9901                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9902                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
9903         return channel_id_arr;
9904 }
9905 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
9906         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9907         assert(obj->tag == LDKEvent_ChannelReady);
9908                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9909                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
9910         return user_channel_id_arr;
9911 }
9912 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
9913         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9914         assert(obj->tag == LDKEvent_ChannelReady);
9915                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9916                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
9917         return counterparty_node_id_arr;
9918 }
9919 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
9920         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9921         assert(obj->tag == LDKEvent_ChannelReady);
9922                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
9923                         uint64_t channel_type_ref = 0;
9924                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
9925                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
9926         return channel_type_ref;
9927 }
9928 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
9929         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9930         assert(obj->tag == LDKEvent_ChannelClosed);
9931                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9932                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
9933         return channel_id_arr;
9934 }
9935 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
9936         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9937         assert(obj->tag == LDKEvent_ChannelClosed);
9938                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9939                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
9940         return user_channel_id_arr;
9941 }
9942 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
9943         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9944         assert(obj->tag == LDKEvent_ChannelClosed);
9945                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
9946         return reason_ref;
9947 }
9948 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
9949         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9950         assert(obj->tag == LDKEvent_ChannelClosed);
9951                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9952                         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
9953         return counterparty_node_id_arr;
9954 }
9955 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
9956         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9957         assert(obj->tag == LDKEvent_ChannelClosed);
9958                         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
9959         return channel_capacity_sats_ref;
9960 }
9961 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
9962         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9963         assert(obj->tag == LDKEvent_DiscardFunding);
9964                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9965                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
9966         return channel_id_arr;
9967 }
9968 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
9969         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9970         assert(obj->tag == LDKEvent_DiscardFunding);
9971                         LDKTransaction transaction_var = obj->discard_funding.transaction;
9972                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
9973                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
9974         return transaction_arr;
9975 }
9976 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
9977         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9978         assert(obj->tag == LDKEvent_OpenChannelRequest);
9979                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
9980                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
9981         return temporary_channel_id_arr;
9982 }
9983 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
9984         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9985         assert(obj->tag == LDKEvent_OpenChannelRequest);
9986                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9987                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
9988         return counterparty_node_id_arr;
9989 }
9990 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
9991         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9992         assert(obj->tag == LDKEvent_OpenChannelRequest);
9993                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
9994         return funding_satoshis_conv;
9995 }
9996 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
9997         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9998         assert(obj->tag == LDKEvent_OpenChannelRequest);
9999                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
10000         return push_msat_conv;
10001 }
10002 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
10003         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10004         assert(obj->tag == LDKEvent_OpenChannelRequest);
10005                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
10006                         uint64_t channel_type_ref = 0;
10007                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
10008                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
10009         return channel_type_ref;
10010 }
10011 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
10012         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10013         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
10014                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
10015                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
10016         return prev_channel_id_arr;
10017 }
10018 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
10019         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10020         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
10021                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
10022         return failed_next_destination_ref;
10023 }
10024 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
10025         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10026         assert(obj->tag == LDKEvent_BumpTransaction);
10027                         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
10028         return bump_transaction_ref;
10029 }
10030 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
10031         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
10032         switch(obj->tag) {
10033                 case LDKCOption_EventZ_Some: return 0;
10034                 case LDKCOption_EventZ_None: return 1;
10035                 default: abort();
10036         }
10037 }
10038 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
10039         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
10040         assert(obj->tag == LDKCOption_EventZ_Some);
10041                         uint64_t some_ref = tag_ptr(&obj->some, false);
10042         return some_ref;
10043 }
10044 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
10045 CHECK(owner->result_ok);
10046         return COption_EventZ_clone(&*owner->contents.result);
10047 }
10048 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
10049         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
10050         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
10051         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
10052         uint64_t ret_ref = tag_ptr(ret_copy, true);
10053         return ret_ref;
10054 }
10055
10056 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
10057 CHECK(!owner->result_ok);
10058         return DecodeError_clone(&*owner->contents.err);
10059 }
10060 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
10061         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
10062         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10063         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
10064         uint64_t ret_ref = tag_ptr(ret_copy, true);
10065         return ret_ref;
10066 }
10067
10068 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
10069         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10070         switch(obj->tag) {
10071                 case LDKBolt11ParseError_Bech32Error: return 0;
10072                 case LDKBolt11ParseError_ParseAmountError: return 1;
10073                 case LDKBolt11ParseError_MalformedSignature: return 2;
10074                 case LDKBolt11ParseError_BadPrefix: return 3;
10075                 case LDKBolt11ParseError_UnknownCurrency: return 4;
10076                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
10077                 case LDKBolt11ParseError_MalformedHRP: return 6;
10078                 case LDKBolt11ParseError_TooShortDataPart: return 7;
10079                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
10080                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
10081                 case LDKBolt11ParseError_PaddingError: return 10;
10082                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
10083                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
10084                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
10085                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
10086                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
10087                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
10088                 case LDKBolt11ParseError_Skip: return 17;
10089                 default: abort();
10090         }
10091 }
10092 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
10093         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10094         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
10095                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
10096         return bech32_error_ref;
10097 }
10098 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
10099         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10100         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
10101                         /*obj->parse_amount_error*/
10102         return 0;
10103 }
10104 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
10105         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10106         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
10107                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
10108         return malformed_signature_conv;
10109 }
10110 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
10111         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10112         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
10113                         /*obj->description_decode_error*/
10114         return 0;
10115 }
10116 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
10117         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10118         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
10119                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
10120                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
10121         return invalid_slice_length_conv;
10122 }
10123 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10124 CHECK(owner->result_ok);
10125         return SiPrefix_clone(&*owner->contents.result);
10126 }
10127 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
10128         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10129         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
10130         return ret_conv;
10131 }
10132
10133 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10134 CHECK(!owner->result_ok);
10135         return Bolt11ParseError_clone(&*owner->contents.err);
10136 }
10137 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
10138         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10139         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10140         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
10141         uint64_t ret_ref = tag_ptr(ret_copy, true);
10142         return ret_ref;
10143 }
10144
10145 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
10146         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10147         switch(obj->tag) {
10148                 case LDKParseOrSemanticError_ParseError: return 0;
10149                 case LDKParseOrSemanticError_SemanticError: return 1;
10150                 default: abort();
10151         }
10152 }
10153 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
10154         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10155         assert(obj->tag == LDKParseOrSemanticError_ParseError);
10156                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
10157         return parse_error_ref;
10158 }
10159 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
10160         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10161         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
10162                         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
10163         return semantic_error_conv;
10164 }
10165 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10166         LDKBolt11Invoice ret = *owner->contents.result;
10167         ret.is_owned = false;
10168         return ret;
10169 }
10170 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
10171         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10172         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
10173         uint64_t ret_ref = 0;
10174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10176         return ret_ref;
10177 }
10178
10179 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10180 CHECK(!owner->result_ok);
10181         return ParseOrSemanticError_clone(&*owner->contents.err);
10182 }
10183 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
10184         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10185         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
10186         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
10187         uint64_t ret_ref = tag_ptr(ret_copy, true);
10188         return ret_ref;
10189 }
10190
10191 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10192         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
10193         ret.is_owned = false;
10194         return ret;
10195 }
10196 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
10197         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10198         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
10199         uint64_t ret_ref = 0;
10200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10202         return ret_ref;
10203 }
10204
10205 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10206 CHECK(!owner->result_ok);
10207         return Bolt11ParseError_clone(&*owner->contents.err);
10208 }
10209 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
10210         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10211         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10212         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
10213         uint64_t ret_ref = tag_ptr(ret_copy, true);
10214         return ret_ref;
10215 }
10216
10217 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10218         LDKRawBolt11Invoice ret = owner->a;
10219         ret.is_owned = false;
10220         return ret;
10221 }
10222 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
10223         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10224         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
10225         uint64_t ret_ref = 0;
10226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10228         return ret_ref;
10229 }
10230
10231 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10232         return ThirtyTwoBytes_clone(&owner->b);
10233 }
10234 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
10235         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10236         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10237         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
10238         return ret_arr;
10239 }
10240
10241 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10242         LDKBolt11InvoiceSignature ret = owner->c;
10243         ret.is_owned = false;
10244         return ret;
10245 }
10246 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
10247         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10248         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
10249         uint64_t ret_ref = 0;
10250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10252         return ret_ref;
10253 }
10254
10255 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
10256         LDKPayeePubKey ret = *owner->contents.result;
10257         ret.is_owned = false;
10258         return ret;
10259 }
10260 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
10261         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
10262         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
10263         uint64_t ret_ref = 0;
10264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10266         return ret_ref;
10267 }
10268
10269 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
10270 CHECK(!owner->result_ok);
10271         return *owner->contents.err;
10272 }
10273 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
10274         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
10275         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
10276         return ret_conv;
10277 }
10278
10279 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
10280         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
10281         for (size_t i = 0; i < ret.datalen; i++) {
10282                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
10283         }
10284         return ret;
10285 }
10286 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10287         LDKPositiveTimestamp ret = *owner->contents.result;
10288         ret.is_owned = false;
10289         return ret;
10290 }
10291 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
10292         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10293         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
10294         uint64_t ret_ref = 0;
10295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10297         return ret_ref;
10298 }
10299
10300 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10301 CHECK(!owner->result_ok);
10302         return CreationError_clone(&*owner->contents.err);
10303 }
10304 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
10305         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10306         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
10307         return ret_conv;
10308 }
10309
10310 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10311 CHECK(owner->result_ok);
10312         return *owner->contents.result;
10313 }
10314 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10315         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10316         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
10317 }
10318
10319 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10320 CHECK(!owner->result_ok);
10321         return Bolt11SemanticError_clone(&*owner->contents.err);
10322 }
10323 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
10324         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10325         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
10326         return ret_conv;
10327 }
10328
10329 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10330         LDKBolt11Invoice ret = *owner->contents.result;
10331         ret.is_owned = false;
10332         return ret;
10333 }
10334 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10335         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10336         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
10337         uint64_t ret_ref = 0;
10338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10340         return ret_ref;
10341 }
10342
10343 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10344 CHECK(!owner->result_ok);
10345         return Bolt11SemanticError_clone(&*owner->contents.err);
10346 }
10347 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
10348         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10349         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
10350         return ret_conv;
10351 }
10352
10353 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10354         LDKDescription ret = *owner->contents.result;
10355         ret.is_owned = false;
10356         return ret;
10357 }
10358 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
10359         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10360         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
10361         uint64_t ret_ref = 0;
10362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10364         return ret_ref;
10365 }
10366
10367 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10368 CHECK(!owner->result_ok);
10369         return CreationError_clone(&*owner->contents.err);
10370 }
10371 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
10372         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10373         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
10374         return ret_conv;
10375 }
10376
10377 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10378         LDKPrivateRoute ret = *owner->contents.result;
10379         ret.is_owned = false;
10380         return ret;
10381 }
10382 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
10383         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10384         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
10385         uint64_t ret_ref = 0;
10386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10388         return ret_ref;
10389 }
10390
10391 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10392 CHECK(!owner->result_ok);
10393         return CreationError_clone(&*owner->contents.err);
10394 }
10395 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
10396         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10397         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
10398         return ret_conv;
10399 }
10400
10401 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
10402         LDKOutPoint ret = *owner->contents.result;
10403         ret.is_owned = false;
10404         return ret;
10405 }
10406 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
10407         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
10408         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
10409         uint64_t ret_ref = 0;
10410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10412         return ret_ref;
10413 }
10414
10415 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
10416 CHECK(!owner->result_ok);
10417         return DecodeError_clone(&*owner->contents.err);
10418 }
10419 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
10420         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
10421         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10422         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
10423         uint64_t ret_ref = tag_ptr(ret_copy, true);
10424         return ret_ref;
10425 }
10426
10427 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
10428         LDKBigSize ret = *owner->contents.result;
10429         ret.is_owned = false;
10430         return ret;
10431 }
10432 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
10433         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
10434         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
10435         uint64_t ret_ref = 0;
10436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10438         return ret_ref;
10439 }
10440
10441 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
10442 CHECK(!owner->result_ok);
10443         return DecodeError_clone(&*owner->contents.err);
10444 }
10445 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
10446         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
10447         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10448         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
10449         uint64_t ret_ref = tag_ptr(ret_copy, true);
10450         return ret_ref;
10451 }
10452
10453 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
10454         LDKHostname ret = *owner->contents.result;
10455         ret.is_owned = false;
10456         return ret;
10457 }
10458 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
10459         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
10460         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_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 struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
10468 CHECK(!owner->result_ok);
10469         return DecodeError_clone(&*owner->contents.err);
10470 }
10471 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
10472         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
10473         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10474         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
10475         uint64_t ret_ref = tag_ptr(ret_copy, true);
10476         return ret_ref;
10477 }
10478
10479 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
10480         LDKTransactionU16LenLimited ret = *owner->contents.result;
10481         ret.is_owned = false;
10482         return ret;
10483 }
10484 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
10485         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
10486         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
10487         uint64_t ret_ref = 0;
10488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10490         return ret_ref;
10491 }
10492
10493 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
10494 CHECK(!owner->result_ok);
10495         return *owner->contents.err;
10496 }
10497 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
10498         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
10499         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
10500 }
10501
10502 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
10503         LDKTransactionU16LenLimited ret = *owner->contents.result;
10504         ret.is_owned = false;
10505         return ret;
10506 }
10507 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
10508         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
10509         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
10510         uint64_t ret_ref = 0;
10511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10513         return ret_ref;
10514 }
10515
10516 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
10517 CHECK(!owner->result_ok);
10518         return DecodeError_clone(&*owner->contents.err);
10519 }
10520 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
10521         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
10522         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10523         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
10524         uint64_t ret_ref = tag_ptr(ret_copy, true);
10525         return ret_ref;
10526 }
10527
10528 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
10529         LDKUntrustedString ret = *owner->contents.result;
10530         ret.is_owned = false;
10531         return ret;
10532 }
10533 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
10534         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
10535         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
10536         uint64_t ret_ref = 0;
10537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10539         return ret_ref;
10540 }
10541
10542 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
10543 CHECK(!owner->result_ok);
10544         return DecodeError_clone(&*owner->contents.err);
10545 }
10546 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
10547         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
10548         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10549         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
10550         uint64_t ret_ref = tag_ptr(ret_copy, true);
10551         return ret_ref;
10552 }
10553
10554 static inline struct LDKReceiveTlvs CResult_ReceiveTlvsDecodeErrorZ_get_ok(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
10555         LDKReceiveTlvs ret = *owner->contents.result;
10556         ret.is_owned = false;
10557         return ret;
10558 }
10559 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_get_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_get_ok(uint64_t owner) {
10560         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
10561         LDKReceiveTlvs ret_var = CResult_ReceiveTlvsDecodeErrorZ_get_ok(owner_conv);
10562         uint64_t ret_ref = 0;
10563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10565         return ret_ref;
10566 }
10567
10568 static inline struct LDKDecodeError CResult_ReceiveTlvsDecodeErrorZ_get_err(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
10569 CHECK(!owner->result_ok);
10570         return DecodeError_clone(&*owner->contents.err);
10571 }
10572 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_get_err"))) TS_CResult_ReceiveTlvsDecodeErrorZ_get_err(uint64_t owner) {
10573         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
10574         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10575         *ret_copy = CResult_ReceiveTlvsDecodeErrorZ_get_err(owner_conv);
10576         uint64_t ret_ref = tag_ptr(ret_copy, true);
10577         return ret_ref;
10578 }
10579
10580 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
10581         LDKPaymentRelay ret = *owner->contents.result;
10582         ret.is_owned = false;
10583         return ret;
10584 }
10585 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
10586         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
10587         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
10588         uint64_t ret_ref = 0;
10589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10591         return ret_ref;
10592 }
10593
10594 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
10595 CHECK(!owner->result_ok);
10596         return DecodeError_clone(&*owner->contents.err);
10597 }
10598 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
10599         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
10600         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10601         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
10602         uint64_t ret_ref = tag_ptr(ret_copy, true);
10603         return ret_ref;
10604 }
10605
10606 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
10607         LDKPaymentConstraints ret = *owner->contents.result;
10608         ret.is_owned = false;
10609         return ret;
10610 }
10611 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
10612         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
10613         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
10614         uint64_t ret_ref = 0;
10615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10617         return ret_ref;
10618 }
10619
10620 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
10621 CHECK(!owner->result_ok);
10622         return DecodeError_clone(&*owner->contents.err);
10623 }
10624 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
10625         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
10626         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10627         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
10628         uint64_t ret_ref = tag_ptr(ret_copy, true);
10629         return ret_ref;
10630 }
10631
10632 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
10633         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10634         switch(obj->tag) {
10635                 case LDKPaymentError_Invoice: return 0;
10636                 case LDKPaymentError_Sending: return 1;
10637                 default: abort();
10638         }
10639 }
10640 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
10641         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10642         assert(obj->tag == LDKPaymentError_Invoice);
10643                         LDKStr invoice_str = obj->invoice;
10644                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
10645         return invoice_conv;
10646 }
10647 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
10648         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10649         assert(obj->tag == LDKPaymentError_Sending);
10650                         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
10651         return sending_conv;
10652 }
10653 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
10654 CHECK(owner->result_ok);
10655         return ThirtyTwoBytes_clone(&*owner->contents.result);
10656 }
10657 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(uint64_t owner) {
10658         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
10659         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10660         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(owner_conv).data, 32);
10661         return ret_arr;
10662 }
10663
10664 static inline struct LDKPaymentError CResult_ThirtyTwoBytesPaymentErrorZ_get_err(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
10665 CHECK(!owner->result_ok);
10666         return PaymentError_clone(&*owner->contents.err);
10667 }
10668 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_err(uint64_t owner) {
10669         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
10670         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
10671         *ret_copy = CResult_ThirtyTwoBytesPaymentErrorZ_get_err(owner_conv);
10672         uint64_t ret_ref = tag_ptr(ret_copy, true);
10673         return ret_ref;
10674 }
10675
10676 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
10677 CHECK(owner->result_ok);
10678         return *owner->contents.result;
10679 }
10680 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
10681         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
10682         CResult_NonePaymentErrorZ_get_ok(owner_conv);
10683 }
10684
10685 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
10686 CHECK(!owner->result_ok);
10687         return PaymentError_clone(&*owner->contents.err);
10688 }
10689 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
10690         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
10691         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
10692         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
10693         uint64_t ret_ref = tag_ptr(ret_copy, true);
10694         return ret_ref;
10695 }
10696
10697 uint32_t __attribute__((export_name("TS_LDKProbingError_ty_from_ptr"))) TS_LDKProbingError_ty_from_ptr(uint64_t ptr) {
10698         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10699         switch(obj->tag) {
10700                 case LDKProbingError_Invoice: return 0;
10701                 case LDKProbingError_Sending: return 1;
10702                 default: abort();
10703         }
10704 }
10705 jstring __attribute__((export_name("TS_LDKProbingError_Invoice_get_invoice"))) TS_LDKProbingError_Invoice_get_invoice(uint64_t ptr) {
10706         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10707         assert(obj->tag == LDKProbingError_Invoice);
10708                         LDKStr invoice_str = obj->invoice;
10709                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
10710         return invoice_conv;
10711 }
10712 uint64_t __attribute__((export_name("TS_LDKProbingError_Sending_get_sending"))) TS_LDKProbingError_Sending_get_sending(uint64_t ptr) {
10713         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10714         assert(obj->tag == LDKProbingError_Sending);
10715                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
10716         return sending_ref;
10717 }
10718 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
10719 CHECK(owner->result_ok);
10720         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
10721 }
10722 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(uint64_t owner) {
10723         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
10724         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(owner_conv);
10725         uint64_tArray ret_arr = NULL;
10726         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10727         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10728         for (size_t o = 0; o < ret_var.datalen; o++) {
10729                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
10730                 *ret_conv_40_conv = ret_var.data[o];
10731                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
10732         }
10733         
10734         FREE(ret_var.data);
10735         return ret_arr;
10736 }
10737
10738 static inline struct LDKProbingError CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
10739 CHECK(!owner->result_ok);
10740         return ProbingError_clone(&*owner->contents.err);
10741 }
10742 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(uint64_t owner) {
10743         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
10744         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
10745         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(owner_conv);
10746         uint64_t ret_ref = tag_ptr(ret_copy, true);
10747         return ret_ref;
10748 }
10749
10750 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
10751 CHECK(owner->result_ok);
10752         return *owner->contents.result;
10753 }
10754 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
10755         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
10756         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
10757         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10758         return ret_conv;
10759 }
10760
10761 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
10762 CHECK(!owner->result_ok);
10763         return *owner->contents.err;
10764 }
10765 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
10766         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
10767         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
10768         return ret_conv;
10769 }
10770
10771 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
10772         LDKOnionMessagePath ret = *owner->contents.result;
10773         ret.is_owned = false;
10774         return ret;
10775 }
10776 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
10777         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
10778         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
10779         uint64_t ret_ref = 0;
10780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10782         return ret_ref;
10783 }
10784
10785 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
10786 CHECK(!owner->result_ok);
10787         return *owner->contents.err;
10788 }
10789 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
10790         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
10791         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
10792 }
10793
10794 static inline struct LDKPublicKey C2Tuple_PublicKeyOnionMessageZ_get_a(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
10795         return owner->a;
10796 }
10797 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_get_a"))) TS_C2Tuple_PublicKeyOnionMessageZ_get_a(uint64_t owner) {
10798         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
10799         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10800         memcpy(ret_arr->elems, C2Tuple_PublicKeyOnionMessageZ_get_a(owner_conv).compressed_form, 33);
10801         return ret_arr;
10802 }
10803
10804 static inline struct LDKOnionMessage C2Tuple_PublicKeyOnionMessageZ_get_b(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
10805         LDKOnionMessage ret = owner->b;
10806         ret.is_owned = false;
10807         return ret;
10808 }
10809 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_get_b"))) TS_C2Tuple_PublicKeyOnionMessageZ_get_b(uint64_t owner) {
10810         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
10811         LDKOnionMessage ret_var = C2Tuple_PublicKeyOnionMessageZ_get_b(owner_conv);
10812         uint64_t ret_ref = 0;
10813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10815         return ret_ref;
10816 }
10817
10818 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
10819         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
10820         switch(obj->tag) {
10821                 case LDKSendError_Secp256k1: return 0;
10822                 case LDKSendError_TooBigPacket: return 1;
10823                 case LDKSendError_TooFewBlindedHops: return 2;
10824                 case LDKSendError_InvalidFirstHop: return 3;
10825                 case LDKSendError_InvalidMessage: return 4;
10826                 case LDKSendError_BufferFull: return 5;
10827                 case LDKSendError_GetNodeIdFailed: return 6;
10828                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
10829                 default: abort();
10830         }
10831 }
10832 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
10833         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
10834         assert(obj->tag == LDKSendError_Secp256k1);
10835                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
10836         return secp256k1_conv;
10837 }
10838 static inline struct LDKC2Tuple_PublicKeyOnionMessageZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
10839 CHECK(owner->result_ok);
10840         return C2Tuple_PublicKeyOnionMessageZ_clone(&*owner->contents.result);
10841 }
10842 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(uint64_t owner) {
10843         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
10844         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
10845         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(owner_conv);
10846         return tag_ptr(ret_conv, true);
10847 }
10848
10849 static inline struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
10850 CHECK(!owner->result_ok);
10851         return SendError_clone(&*owner->contents.err);
10852 }
10853 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(uint64_t owner) {
10854         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
10855         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
10856         *ret_copy = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(owner_conv);
10857         uint64_t ret_ref = tag_ptr(ret_copy, true);
10858         return ret_ref;
10859 }
10860
10861 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
10862 CHECK(owner->result_ok);
10863         return *owner->contents.result;
10864 }
10865 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
10866         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
10867         CResult_NoneSendErrorZ_get_ok(owner_conv);
10868 }
10869
10870 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
10871 CHECK(!owner->result_ok);
10872         return SendError_clone(&*owner->contents.err);
10873 }
10874 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
10875         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
10876         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
10877         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
10878         uint64_t ret_ref = tag_ptr(ret_copy, true);
10879         return ret_ref;
10880 }
10881
10882 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
10883         LDKBlindedPath ret = *owner->contents.result;
10884         ret.is_owned = false;
10885         return ret;
10886 }
10887 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
10888         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
10889         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
10890         uint64_t ret_ref = 0;
10891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10893         return ret_ref;
10894 }
10895
10896 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
10897 CHECK(!owner->result_ok);
10898         return *owner->contents.err;
10899 }
10900 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
10901         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
10902         CResult_BlindedPathNoneZ_get_err(owner_conv);
10903 }
10904
10905 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
10906 CHECK(owner->result_ok);
10907         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
10908 }
10909 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
10910         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
10911         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
10912         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
10913         return tag_ptr(ret_conv, true);
10914 }
10915
10916 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
10917 CHECK(!owner->result_ok);
10918         return *owner->contents.err;
10919 }
10920 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
10921         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
10922         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
10923 }
10924
10925 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
10926         LDKBlindedPath ret = *owner->contents.result;
10927         ret.is_owned = false;
10928         return ret;
10929 }
10930 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
10931         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
10932         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
10933         uint64_t ret_ref = 0;
10934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10936         return ret_ref;
10937 }
10938
10939 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
10940 CHECK(!owner->result_ok);
10941         return DecodeError_clone(&*owner->contents.err);
10942 }
10943 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
10944         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
10945         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10946         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
10947         uint64_t ret_ref = tag_ptr(ret_copy, true);
10948         return ret_ref;
10949 }
10950
10951 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
10952         LDKBlindedHop ret = *owner->contents.result;
10953         ret.is_owned = false;
10954         return ret;
10955 }
10956 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
10957         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
10958         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
10959         uint64_t ret_ref = 0;
10960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10962         return ret_ref;
10963 }
10964
10965 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
10966 CHECK(!owner->result_ok);
10967         return DecodeError_clone(&*owner->contents.err);
10968 }
10969 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
10970         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
10971         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10972         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
10973         uint64_t ret_ref = tag_ptr(ret_copy, true);
10974         return ret_ref;
10975 }
10976
10977 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
10978         LDKInvoiceError ret = *owner->contents.result;
10979         ret.is_owned = false;
10980         return ret;
10981 }
10982 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
10983         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
10984         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
10985         uint64_t ret_ref = 0;
10986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10988         return ret_ref;
10989 }
10990
10991 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
10992 CHECK(!owner->result_ok);
10993         return DecodeError_clone(&*owner->contents.err);
10994 }
10995 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
10996         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
10997         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10998         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
10999         uint64_t ret_ref = tag_ptr(ret_copy, true);
11000         return ret_ref;
11001 }
11002
11003 typedef struct LDKFilter_JCalls {
11004         atomic_size_t refcnt;
11005         uint32_t instance_ptr;
11006 } LDKFilter_JCalls;
11007 static void LDKFilter_JCalls_free(void* this_arg) {
11008         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11009         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11010                 FREE(j_calls);
11011         }
11012 }
11013 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
11014         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11015         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
11016         memcpy(txid_arr->elems, *txid, 32);
11017         LDKu8slice script_pubkey_var = script_pubkey;
11018         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
11019         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
11020         js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
11021 }
11022 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
11023         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11024         LDKWatchedOutput output_var = output;
11025         uint64_t output_ref = 0;
11026         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
11027         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
11028         js_invoke_function_buuuuu(j_calls->instance_ptr, 44, output_ref, 0, 0, 0, 0, 0);
11029 }
11030 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
11031         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
11032         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11033 }
11034 static inline LDKFilter LDKFilter_init (JSValue o) {
11035         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
11036         atomic_init(&calls->refcnt, 1);
11037         calls->instance_ptr = o;
11038
11039         LDKFilter ret = {
11040                 .this_arg = (void*) calls,
11041                 .register_tx = register_tx_LDKFilter_jcall,
11042                 .register_output = register_output_LDKFilter_jcall,
11043                 .free = LDKFilter_JCalls_free,
11044         };
11045         return ret;
11046 }
11047 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
11048         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
11049         *res_ptr = LDKFilter_init(o);
11050         return tag_ptr(res_ptr, true);
11051 }
11052 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
11053         void* this_arg_ptr = untag_ptr(this_arg);
11054         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11055         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11056         uint8_t txid_arr[32];
11057         CHECK(txid->arr_len == 32);
11058         memcpy(txid_arr, txid->elems, 32); FREE(txid);
11059         uint8_t (*txid_ref)[32] = &txid_arr;
11060         LDKu8slice script_pubkey_ref;
11061         script_pubkey_ref.datalen = script_pubkey->arr_len;
11062         script_pubkey_ref.data = script_pubkey->elems;
11063         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
11064         FREE(script_pubkey);
11065 }
11066
11067 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
11068         void* this_arg_ptr = untag_ptr(this_arg);
11069         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11070         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11071         LDKWatchedOutput output_conv;
11072         output_conv.inner = untag_ptr(output);
11073         output_conv.is_owned = ptr_is_owned(output);
11074         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
11075         output_conv = WatchedOutput_clone(&output_conv);
11076         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
11077 }
11078
11079 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
11080         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11081         switch(obj->tag) {
11082                 case LDKCOption_FilterZ_Some: return 0;
11083                 case LDKCOption_FilterZ_None: return 1;
11084                 default: abort();
11085         }
11086 }
11087 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
11088         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11089         assert(obj->tag == LDKCOption_FilterZ_Some);
11090                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
11091                         *some_ret = obj->some;
11092                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
11093                         if ((*some_ret).free == LDKFilter_JCalls_free) {
11094                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11095                                 LDKFilter_JCalls_cloned(&(*some_ret));
11096                         }
11097         return tag_ptr(some_ret, true);
11098 }
11099 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11100         LDKLockedChannelMonitor ret = *owner->contents.result;
11101         ret.is_owned = false;
11102         return ret;
11103 }
11104 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
11105         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11106         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
11107         uint64_t ret_ref = 0;
11108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11110         return ret_ref;
11111 }
11112
11113 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11114 CHECK(!owner->result_ok);
11115         return *owner->contents.err;
11116 }
11117 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
11118         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11119         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
11120 }
11121
11122 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
11123         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
11124         for (size_t i = 0; i < ret.datalen; i++) {
11125                 ret.data[i] = OutPoint_clone(&orig->data[i]);
11126         }
11127         return ret;
11128 }
11129 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
11130         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
11131         for (size_t i = 0; i < ret.datalen; i++) {
11132                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
11133         }
11134         return ret;
11135 }
11136 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11137         LDKOutPoint ret = owner->a;
11138         ret.is_owned = false;
11139         return ret;
11140 }
11141 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
11142         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11143         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
11144         uint64_t ret_ref = 0;
11145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11147         return ret_ref;
11148 }
11149
11150 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11151         return CVec_MonitorUpdateIdZ_clone(&owner->b);
11152 }
11153 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
11154         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11155         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
11156         uint64_tArray ret_arr = NULL;
11157         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11158         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11159         for (size_t r = 0; r < ret_var.datalen; r++) {
11160                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
11161                 uint64_t ret_conv_17_ref = 0;
11162                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
11163                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
11164                 ret_arr_ptr[r] = ret_conv_17_ref;
11165         }
11166         
11167         FREE(ret_var.data);
11168         return ret_arr;
11169 }
11170
11171 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
11172         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
11173         for (size_t i = 0; i < ret.datalen; i++) {
11174                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
11175         }
11176         return ret;
11177 }
11178 typedef struct LDKKVStore_JCalls {
11179         atomic_size_t refcnt;
11180         uint32_t instance_ptr;
11181 } LDKKVStore_JCalls;
11182 static void LDKKVStore_JCalls_free(void* this_arg) {
11183         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11184         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11185                 FREE(j_calls);
11186         }
11187 }
11188 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
11189         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11190         LDKStr primary_namespace_str = primary_namespace;
11191         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11192         Str_free(primary_namespace_str);
11193         LDKStr secondary_namespace_str = secondary_namespace;
11194         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11195         Str_free(secondary_namespace_str);
11196         LDKStr key_str = key;
11197         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11198         Str_free(key_str);
11199         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
11200         void* ret_ptr = untag_ptr(ret);
11201         CHECK_ACCESS(ret_ptr);
11202         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
11203         FREE(untag_ptr(ret));
11204         return ret_conv;
11205 }
11206 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
11207         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11208         LDKStr primary_namespace_str = primary_namespace;
11209         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11210         Str_free(primary_namespace_str);
11211         LDKStr secondary_namespace_str = secondary_namespace;
11212         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11213         Str_free(secondary_namespace_str);
11214         LDKStr key_str = key;
11215         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11216         Str_free(key_str);
11217         LDKu8slice buf_var = buf;
11218         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
11219         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
11220         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, primary_namespace_conv, secondary_namespace_conv, key_conv, (uint32_t)buf_arr, 0, 0);
11221         void* ret_ptr = untag_ptr(ret);
11222         CHECK_ACCESS(ret_ptr);
11223         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11224         FREE(untag_ptr(ret));
11225         return ret_conv;
11226 }
11227 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
11228         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11229         LDKStr primary_namespace_str = primary_namespace;
11230         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11231         Str_free(primary_namespace_str);
11232         LDKStr secondary_namespace_str = secondary_namespace;
11233         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11234         Str_free(secondary_namespace_str);
11235         LDKStr key_str = key;
11236         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11237         Str_free(key_str);
11238         jboolean lazy_conv = lazy;
11239         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
11240         void* ret_ptr = untag_ptr(ret);
11241         CHECK_ACCESS(ret_ptr);
11242         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11243         FREE(untag_ptr(ret));
11244         return ret_conv;
11245 }
11246 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
11247         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11248         LDKStr primary_namespace_str = primary_namespace;
11249         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11250         Str_free(primary_namespace_str);
11251         LDKStr secondary_namespace_str = secondary_namespace;
11252         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11253         Str_free(secondary_namespace_str);
11254         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
11255         void* ret_ptr = untag_ptr(ret);
11256         CHECK_ACCESS(ret_ptr);
11257         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
11258         FREE(untag_ptr(ret));
11259         return ret_conv;
11260 }
11261 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
11262         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
11263         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11264 }
11265 static inline LDKKVStore LDKKVStore_init (JSValue o) {
11266         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
11267         atomic_init(&calls->refcnt, 1);
11268         calls->instance_ptr = o;
11269
11270         LDKKVStore ret = {
11271                 .this_arg = (void*) calls,
11272                 .read = read_LDKKVStore_jcall,
11273                 .write = write_LDKKVStore_jcall,
11274                 .remove = remove_LDKKVStore_jcall,
11275                 .list = list_LDKKVStore_jcall,
11276                 .free = LDKKVStore_JCalls_free,
11277         };
11278         return ret;
11279 }
11280 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
11281         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
11282         *res_ptr = LDKKVStore_init(o);
11283         return tag_ptr(res_ptr, true);
11284 }
11285 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
11286         void* this_arg_ptr = untag_ptr(this_arg);
11287         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11288         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11289         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11290         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11291         LDKStr key_conv = str_ref_to_owned_c(key);
11292         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
11293         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
11294         return tag_ptr(ret_conv, true);
11295 }
11296
11297 uint64_t  __attribute__((export_name("TS_KVStore_write"))) TS_KVStore_write(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
11298         void* this_arg_ptr = untag_ptr(this_arg);
11299         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11300         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11301         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11302         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11303         LDKStr key_conv = str_ref_to_owned_c(key);
11304         LDKu8slice buf_ref;
11305         buf_ref.datalen = buf->arr_len;
11306         buf_ref.data = buf->elems;
11307         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11308         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
11309         FREE(buf);
11310         return tag_ptr(ret_conv, true);
11311 }
11312
11313 uint64_t  __attribute__((export_name("TS_KVStore_remove"))) TS_KVStore_remove(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
11314         void* this_arg_ptr = untag_ptr(this_arg);
11315         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11316         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11317         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11318         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11319         LDKStr key_conv = str_ref_to_owned_c(key);
11320         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11321         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
11322         return tag_ptr(ret_conv, true);
11323 }
11324
11325 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
11326         void* this_arg_ptr = untag_ptr(this_arg);
11327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11328         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11329         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11330         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11331         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
11332         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
11333         return tag_ptr(ret_conv, true);
11334 }
11335
11336 typedef struct LDKScoreLookUp_JCalls {
11337         atomic_size_t refcnt;
11338         uint32_t instance_ptr;
11339 } LDKScoreLookUp_JCalls;
11340 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
11341         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
11342         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11343                 FREE(j_calls);
11344         }
11345 }
11346 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
11347         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
11348         int64_t short_channel_id_conv = short_channel_id;
11349         LDKNodeId source_var = *source;
11350         uint64_t source_ref = 0;
11351         source_var = NodeId_clone(&source_var);
11352         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
11353         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
11354         LDKNodeId target_var = *target;
11355         uint64_t target_ref = 0;
11356         target_var = NodeId_clone(&target_var);
11357         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
11358         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
11359         LDKChannelUsage usage_var = usage;
11360         uint64_t usage_ref = 0;
11361         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
11362         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
11363         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
11364         uint64_t score_params_ref = 0;
11365         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
11366         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
11367         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
11368         return js_invoke_function_bbbbbu(j_calls->instance_ptr, 49, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref, 0);
11369 }
11370 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
11371         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
11372         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11373 }
11374 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
11375         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
11376         atomic_init(&calls->refcnt, 1);
11377         calls->instance_ptr = o;
11378
11379         LDKScoreLookUp ret = {
11380                 .this_arg = (void*) calls,
11381                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
11382                 .free = LDKScoreLookUp_JCalls_free,
11383         };
11384         return ret;
11385 }
11386 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
11387         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
11388         *res_ptr = LDKScoreLookUp_init(o);
11389         return tag_ptr(res_ptr, true);
11390 }
11391 int64_t  __attribute__((export_name("TS_ScoreLookUp_channel_penalty_msat"))) TS_ScoreLookUp_channel_penalty_msat(uint64_t this_arg, int64_t short_channel_id, uint64_t source, uint64_t target, uint64_t usage, uint64_t score_params) {
11392         void* this_arg_ptr = untag_ptr(this_arg);
11393         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11394         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
11395         LDKNodeId source_conv;
11396         source_conv.inner = untag_ptr(source);
11397         source_conv.is_owned = ptr_is_owned(source);
11398         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
11399         source_conv.is_owned = false;
11400         LDKNodeId target_conv;
11401         target_conv.inner = untag_ptr(target);
11402         target_conv.is_owned = ptr_is_owned(target);
11403         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
11404         target_conv.is_owned = false;
11405         LDKChannelUsage usage_conv;
11406         usage_conv.inner = untag_ptr(usage);
11407         usage_conv.is_owned = ptr_is_owned(usage);
11408         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
11409         usage_conv = ChannelUsage_clone(&usage_conv);
11410         LDKProbabilisticScoringFeeParameters score_params_conv;
11411         score_params_conv.inner = untag_ptr(score_params);
11412         score_params_conv.is_owned = ptr_is_owned(score_params);
11413         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
11414         score_params_conv.is_owned = false;
11415         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);
11416         return ret_conv;
11417 }
11418
11419 typedef struct LDKScoreUpdate_JCalls {
11420         atomic_size_t refcnt;
11421         uint32_t instance_ptr;
11422 } LDKScoreUpdate_JCalls;
11423 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
11424         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11425         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11426                 FREE(j_calls);
11427         }
11428 }
11429 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
11430         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11431         LDKPath path_var = *path;
11432         uint64_t path_ref = 0;
11433         path_var = Path_clone(&path_var);
11434         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11435         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11436         int64_t short_channel_id_conv = short_channel_id;
11437         js_invoke_function_bbuuuu(j_calls->instance_ptr, 50, path_ref, short_channel_id_conv, 0, 0, 0, 0);
11438 }
11439 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
11440         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11441         LDKPath path_var = *path;
11442         uint64_t path_ref = 0;
11443         path_var = Path_clone(&path_var);
11444         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11445         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11446         js_invoke_function_buuuuu(j_calls->instance_ptr, 51, path_ref, 0, 0, 0, 0, 0);
11447 }
11448 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
11449         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11450         LDKPath path_var = *path;
11451         uint64_t path_ref = 0;
11452         path_var = Path_clone(&path_var);
11453         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11454         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11455         int64_t short_channel_id_conv = short_channel_id;
11456         js_invoke_function_bbuuuu(j_calls->instance_ptr, 52, path_ref, short_channel_id_conv, 0, 0, 0, 0);
11457 }
11458 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
11459         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11460         LDKPath path_var = *path;
11461         uint64_t path_ref = 0;
11462         path_var = Path_clone(&path_var);
11463         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11464         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11465         js_invoke_function_buuuuu(j_calls->instance_ptr, 53, path_ref, 0, 0, 0, 0, 0);
11466 }
11467 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
11468         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
11469         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11470 }
11471 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
11472         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
11473         atomic_init(&calls->refcnt, 1);
11474         calls->instance_ptr = o;
11475
11476         LDKScoreUpdate ret = {
11477                 .this_arg = (void*) calls,
11478                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
11479                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
11480                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
11481                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
11482                 .free = LDKScoreUpdate_JCalls_free,
11483         };
11484         return ret;
11485 }
11486 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
11487         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
11488         *res_ptr = LDKScoreUpdate_init(o);
11489         return tag_ptr(res_ptr, true);
11490 }
11491 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_failed"))) TS_ScoreUpdate_payment_path_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
11492         void* this_arg_ptr = untag_ptr(this_arg);
11493         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11494         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11495         LDKPath path_conv;
11496         path_conv.inner = untag_ptr(path);
11497         path_conv.is_owned = ptr_is_owned(path);
11498         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11499         path_conv.is_owned = false;
11500         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
11501 }
11502
11503 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_successful"))) TS_ScoreUpdate_payment_path_successful(uint64_t this_arg, uint64_t path) {
11504         void* this_arg_ptr = untag_ptr(this_arg);
11505         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11506         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11507         LDKPath path_conv;
11508         path_conv.inner = untag_ptr(path);
11509         path_conv.is_owned = ptr_is_owned(path);
11510         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11511         path_conv.is_owned = false;
11512         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
11513 }
11514
11515 void  __attribute__((export_name("TS_ScoreUpdate_probe_failed"))) TS_ScoreUpdate_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
11516         void* this_arg_ptr = untag_ptr(this_arg);
11517         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11518         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11519         LDKPath path_conv;
11520         path_conv.inner = untag_ptr(path);
11521         path_conv.is_owned = ptr_is_owned(path);
11522         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11523         path_conv.is_owned = false;
11524         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
11525 }
11526
11527 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path) {
11528         void* this_arg_ptr = untag_ptr(this_arg);
11529         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11530         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11531         LDKPath path_conv;
11532         path_conv.inner = untag_ptr(path);
11533         path_conv.is_owned = ptr_is_owned(path);
11534         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11535         path_conv.is_owned = false;
11536         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
11537 }
11538
11539 typedef struct LDKLockableScore_JCalls {
11540         atomic_size_t refcnt;
11541         uint32_t instance_ptr;
11542 } LDKLockableScore_JCalls;
11543 static void LDKLockableScore_JCalls_free(void* this_arg) {
11544         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11545         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11546                 FREE(j_calls);
11547         }
11548 }
11549 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
11550         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11551         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0);
11552         void* ret_ptr = untag_ptr(ret);
11553         CHECK_ACCESS(ret_ptr);
11554         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
11555         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
11556                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11557                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
11558         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
11559         
11560         return ret_conv;
11561 }
11562 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
11563         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11564         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, 0, 0, 0, 0, 0, 0);
11565         void* ret_ptr = untag_ptr(ret);
11566         CHECK_ACCESS(ret_ptr);
11567         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
11568         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
11569                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11570                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
11571         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
11572         
11573         return ret_conv;
11574 }
11575 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
11576         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
11577         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11578 }
11579 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
11580         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
11581         atomic_init(&calls->refcnt, 1);
11582         calls->instance_ptr = o;
11583
11584         LDKLockableScore ret = {
11585                 .this_arg = (void*) calls,
11586                 .read_lock = read_lock_LDKLockableScore_jcall,
11587                 .write_lock = write_lock_LDKLockableScore_jcall,
11588                 .free = LDKLockableScore_JCalls_free,
11589         };
11590         return ret;
11591 }
11592 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
11593         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
11594         *res_ptr = LDKLockableScore_init(o);
11595         return tag_ptr(res_ptr, true);
11596 }
11597 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
11598         void* this_arg_ptr = untag_ptr(this_arg);
11599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11600         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
11601         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
11602         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
11603         return tag_ptr(ret_ret, true);
11604 }
11605
11606 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
11607         void* this_arg_ptr = untag_ptr(this_arg);
11608         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11609         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
11610         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
11611         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
11612         return tag_ptr(ret_ret, true);
11613 }
11614
11615 typedef struct LDKWriteableScore_JCalls {
11616         atomic_size_t refcnt;
11617         uint32_t instance_ptr;
11618         LDKLockableScore_JCalls* LockableScore;
11619 } LDKWriteableScore_JCalls;
11620 static void LDKWriteableScore_JCalls_free(void* this_arg) {
11621         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
11622         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11623                 FREE(j_calls);
11624         }
11625 }
11626 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
11627         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
11628         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, 0, 0, 0, 0, 0, 0);
11629         LDKCVec_u8Z ret_ref;
11630         ret_ref.datalen = ret->arr_len;
11631         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11632         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
11633         return ret_ref;
11634 }
11635 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
11636         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
11637         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11638         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
11639 }
11640 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
11641         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
11642         atomic_init(&calls->refcnt, 1);
11643         calls->instance_ptr = o;
11644
11645         LDKWriteableScore ret = {
11646                 .this_arg = (void*) calls,
11647                 .write = write_LDKWriteableScore_jcall,
11648                 .free = LDKWriteableScore_JCalls_free,
11649                 .LockableScore = LDKLockableScore_init(LockableScore),
11650         };
11651         calls->LockableScore = ret.LockableScore.this_arg;
11652         return ret;
11653 }
11654 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
11655         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
11656         *res_ptr = LDKWriteableScore_init(o, LockableScore);
11657         return tag_ptr(res_ptr, true);
11658 }
11659 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
11660         void* this_arg_ptr = untag_ptr(this_arg);
11661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11662         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
11663         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11664         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
11665         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
11666         CVec_u8Z_free(ret_var);
11667         return ret_arr;
11668 }
11669
11670 typedef struct LDKPersister_JCalls {
11671         atomic_size_t refcnt;
11672         uint32_t instance_ptr;
11673 } LDKPersister_JCalls;
11674 static void LDKPersister_JCalls_free(void* this_arg) {
11675         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11676         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11677                 FREE(j_calls);
11678         }
11679 }
11680 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
11681         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11682         LDKChannelManager channel_manager_var = *channel_manager;
11683         uint64_t channel_manager_ref = 0;
11684         // WARNING: we may need a move here but no clone is available for LDKChannelManager
11685         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
11686         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
11687         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 57, channel_manager_ref, 0, 0, 0, 0, 0);
11688         void* ret_ptr = untag_ptr(ret);
11689         CHECK_ACCESS(ret_ptr);
11690         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11691         FREE(untag_ptr(ret));
11692         return ret_conv;
11693 }
11694 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
11695         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11696         LDKNetworkGraph network_graph_var = *network_graph;
11697         uint64_t network_graph_ref = 0;
11698         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
11699         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
11700         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
11701         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 58, network_graph_ref, 0, 0, 0, 0, 0);
11702         void* ret_ptr = untag_ptr(ret);
11703         CHECK_ACCESS(ret_ptr);
11704         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11705         FREE(untag_ptr(ret));
11706         return ret_conv;
11707 }
11708 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
11709         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11710         // WARNING: This object doesn't live past this scope, needs clone!
11711         uint64_t ret_scorer = tag_ptr(scorer, false);
11712         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 59, ret_scorer, 0, 0, 0, 0, 0);
11713         void* ret_ptr = untag_ptr(ret);
11714         CHECK_ACCESS(ret_ptr);
11715         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11716         FREE(untag_ptr(ret));
11717         return ret_conv;
11718 }
11719 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
11720         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
11721         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11722 }
11723 static inline LDKPersister LDKPersister_init (JSValue o) {
11724         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
11725         atomic_init(&calls->refcnt, 1);
11726         calls->instance_ptr = o;
11727
11728         LDKPersister ret = {
11729                 .this_arg = (void*) calls,
11730                 .persist_manager = persist_manager_LDKPersister_jcall,
11731                 .persist_graph = persist_graph_LDKPersister_jcall,
11732                 .persist_scorer = persist_scorer_LDKPersister_jcall,
11733                 .free = LDKPersister_JCalls_free,
11734         };
11735         return ret;
11736 }
11737 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
11738         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
11739         *res_ptr = LDKPersister_init(o);
11740         return tag_ptr(res_ptr, true);
11741 }
11742 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
11743         void* this_arg_ptr = untag_ptr(this_arg);
11744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11745         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11746         LDKChannelManager channel_manager_conv;
11747         channel_manager_conv.inner = untag_ptr(channel_manager);
11748         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
11749         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
11750         channel_manager_conv.is_owned = false;
11751         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11752         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
11753         return tag_ptr(ret_conv, true);
11754 }
11755
11756 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
11757         void* this_arg_ptr = untag_ptr(this_arg);
11758         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11759         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11760         LDKNetworkGraph network_graph_conv;
11761         network_graph_conv.inner = untag_ptr(network_graph);
11762         network_graph_conv.is_owned = ptr_is_owned(network_graph);
11763         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
11764         network_graph_conv.is_owned = false;
11765         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11766         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
11767         return tag_ptr(ret_conv, true);
11768 }
11769
11770 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
11771         void* this_arg_ptr = untag_ptr(this_arg);
11772         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11773         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11774         void* scorer_ptr = untag_ptr(scorer);
11775         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
11776         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
11777         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11778         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
11779         return tag_ptr(ret_conv, true);
11780 }
11781
11782 typedef struct LDKPersist_JCalls {
11783         atomic_size_t refcnt;
11784         uint32_t instance_ptr;
11785 } LDKPersist_JCalls;
11786 static void LDKPersist_JCalls_free(void* this_arg) {
11787         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11788         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11789                 FREE(j_calls);
11790         }
11791 }
11792 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11793         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11794         LDKOutPoint channel_id_var = channel_id;
11795         uint64_t channel_id_ref = 0;
11796         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11797         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11798         LDKChannelMonitor data_var = *data;
11799         uint64_t data_ref = 0;
11800         data_var = ChannelMonitor_clone(&data_var);
11801         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11802         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11803         LDKMonitorUpdateId update_id_var = update_id;
11804         uint64_t update_id_ref = 0;
11805         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11806         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11807         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 60, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
11808         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
11809         return ret_conv;
11810 }
11811 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11812         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11813         LDKOutPoint channel_id_var = channel_id;
11814         uint64_t channel_id_ref = 0;
11815         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11816         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11817         LDKChannelMonitorUpdate update_var = update;
11818         uint64_t update_ref = 0;
11819         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11820         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
11821         LDKChannelMonitor data_var = *data;
11822         uint64_t data_ref = 0;
11823         data_var = ChannelMonitor_clone(&data_var);
11824         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11825         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11826         LDKMonitorUpdateId update_id_var = update_id;
11827         uint64_t update_id_ref = 0;
11828         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11829         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11830         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 61, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
11831         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
11832         return ret_conv;
11833 }
11834 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11835         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11836         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11837 }
11838 static inline LDKPersist LDKPersist_init (JSValue o) {
11839         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11840         atomic_init(&calls->refcnt, 1);
11841         calls->instance_ptr = o;
11842
11843         LDKPersist ret = {
11844                 .this_arg = (void*) calls,
11845                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11846                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11847                 .free = LDKPersist_JCalls_free,
11848         };
11849         return ret;
11850 }
11851 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
11852         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11853         *res_ptr = LDKPersist_init(o);
11854         return tag_ptr(res_ptr, true);
11855 }
11856 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) {
11857         void* this_arg_ptr = untag_ptr(this_arg);
11858         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11859         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11860         LDKOutPoint channel_id_conv;
11861         channel_id_conv.inner = untag_ptr(channel_id);
11862         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11863         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11864         channel_id_conv = OutPoint_clone(&channel_id_conv);
11865         LDKChannelMonitor data_conv;
11866         data_conv.inner = untag_ptr(data);
11867         data_conv.is_owned = ptr_is_owned(data);
11868         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11869         data_conv.is_owned = false;
11870         LDKMonitorUpdateId update_id_conv;
11871         update_id_conv.inner = untag_ptr(update_id);
11872         update_id_conv.is_owned = ptr_is_owned(update_id);
11873         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11874         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11875         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));
11876         return ret_conv;
11877 }
11878
11879 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) {
11880         void* this_arg_ptr = untag_ptr(this_arg);
11881         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11882         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11883         LDKOutPoint channel_id_conv;
11884         channel_id_conv.inner = untag_ptr(channel_id);
11885         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11886         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11887         channel_id_conv = OutPoint_clone(&channel_id_conv);
11888         LDKChannelMonitorUpdate update_conv;
11889         update_conv.inner = untag_ptr(update);
11890         update_conv.is_owned = ptr_is_owned(update);
11891         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11892         update_conv = ChannelMonitorUpdate_clone(&update_conv);
11893         LDKChannelMonitor data_conv;
11894         data_conv.inner = untag_ptr(data);
11895         data_conv.is_owned = ptr_is_owned(data);
11896         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11897         data_conv.is_owned = false;
11898         LDKMonitorUpdateId update_id_conv;
11899         update_id_conv.inner = untag_ptr(update_id);
11900         update_id_conv.is_owned = ptr_is_owned(update_id);
11901         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11902         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11903         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));
11904         return ret_conv;
11905 }
11906
11907 typedef struct LDKFutureCallback_JCalls {
11908         atomic_size_t refcnt;
11909         uint32_t instance_ptr;
11910 } LDKFutureCallback_JCalls;
11911 static void LDKFutureCallback_JCalls_free(void* this_arg) {
11912         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
11913         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11914                 FREE(j_calls);
11915         }
11916 }
11917 void call_LDKFutureCallback_jcall(const void* this_arg) {
11918         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
11919         js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
11920 }
11921 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
11922         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
11923         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11924 }
11925 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
11926         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
11927         atomic_init(&calls->refcnt, 1);
11928         calls->instance_ptr = o;
11929
11930         LDKFutureCallback ret = {
11931                 .this_arg = (void*) calls,
11932                 .call = call_LDKFutureCallback_jcall,
11933                 .free = LDKFutureCallback_JCalls_free,
11934         };
11935         return ret;
11936 }
11937 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
11938         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
11939         *res_ptr = LDKFutureCallback_init(o);
11940         return tag_ptr(res_ptr, true);
11941 }
11942 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
11943         void* this_arg_ptr = untag_ptr(this_arg);
11944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11945         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
11946         (this_arg_conv->call)(this_arg_conv->this_arg);
11947 }
11948
11949 typedef struct LDKListen_JCalls {
11950         atomic_size_t refcnt;
11951         uint32_t instance_ptr;
11952 } LDKListen_JCalls;
11953 static void LDKListen_JCalls_free(void* this_arg) {
11954         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11955         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11956                 FREE(j_calls);
11957         }
11958 }
11959 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11960         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11961         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11962         memcpy(header_arr->elems, *header, 80);
11963         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11964         uint64_tArray txdata_arr = NULL;
11965         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
11966         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
11967         for (size_t c = 0; c < txdata_var.datalen; c++) {
11968                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11969                 *txdata_conv_28_conv = txdata_var.data[c];
11970                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
11971         }
11972         
11973         FREE(txdata_var.data);
11974         int32_t height_conv = height;
11975         js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
11976 }
11977 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
11978         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11979         LDKu8slice block_var = block;
11980         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
11981         memcpy(block_arr->elems, block_var.data, block_var.datalen);
11982         int32_t height_conv = height;
11983         js_invoke_function_uuuuuu(j_calls->instance_ptr, 64, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
11984 }
11985 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11986         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11987         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11988         memcpy(header_arr->elems, *header, 80);
11989         int32_t height_conv = height;
11990         js_invoke_function_uuuuuu(j_calls->instance_ptr, 65, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
11991 }
11992 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
11993         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
11994         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11995 }
11996 static inline LDKListen LDKListen_init (JSValue o) {
11997         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
11998         atomic_init(&calls->refcnt, 1);
11999         calls->instance_ptr = o;
12000
12001         LDKListen ret = {
12002                 .this_arg = (void*) calls,
12003                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
12004                 .block_connected = block_connected_LDKListen_jcall,
12005                 .block_disconnected = block_disconnected_LDKListen_jcall,
12006                 .free = LDKListen_JCalls_free,
12007         };
12008         return ret;
12009 }
12010 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
12011         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
12012         *res_ptr = LDKListen_init(o);
12013         return tag_ptr(res_ptr, true);
12014 }
12015 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) {
12016         void* this_arg_ptr = untag_ptr(this_arg);
12017         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12018         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12019         uint8_t header_arr[80];
12020         CHECK(header->arr_len == 80);
12021         memcpy(header_arr, header->elems, 80); FREE(header);
12022         uint8_t (*header_ref)[80] = &header_arr;
12023         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12024         txdata_constr.datalen = txdata->arr_len;
12025         if (txdata_constr.datalen > 0)
12026                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12027         else
12028                 txdata_constr.data = NULL;
12029         uint64_t* txdata_vals = txdata->elems;
12030         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12031                 uint64_t txdata_conv_28 = txdata_vals[c];
12032                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12033                 CHECK_ACCESS(txdata_conv_28_ptr);
12034                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12035                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12036                 txdata_constr.data[c] = txdata_conv_28_conv;
12037         }
12038         FREE(txdata);
12039         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12040 }
12041
12042 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
12043         void* this_arg_ptr = untag_ptr(this_arg);
12044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12045         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12046         LDKu8slice block_ref;
12047         block_ref.datalen = block->arr_len;
12048         block_ref.data = block->elems;
12049         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
12050         FREE(block);
12051 }
12052
12053 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
12054         void* this_arg_ptr = untag_ptr(this_arg);
12055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12056         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12057         uint8_t header_arr[80];
12058         CHECK(header->arr_len == 80);
12059         memcpy(header_arr, header->elems, 80); FREE(header);
12060         uint8_t (*header_ref)[80] = &header_arr;
12061         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
12062 }
12063
12064 typedef struct LDKConfirm_JCalls {
12065         atomic_size_t refcnt;
12066         uint32_t instance_ptr;
12067 } LDKConfirm_JCalls;
12068 static void LDKConfirm_JCalls_free(void* this_arg) {
12069         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12070         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12071                 FREE(j_calls);
12072         }
12073 }
12074 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
12075         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12076         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12077         memcpy(header_arr->elems, *header, 80);
12078         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
12079         uint64_tArray txdata_arr = NULL;
12080         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
12081         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
12082         for (size_t c = 0; c < txdata_var.datalen; c++) {
12083                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12084                 *txdata_conv_28_conv = txdata_var.data[c];
12085                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
12086         }
12087         
12088         FREE(txdata_var.data);
12089         int32_t height_conv = height;
12090         js_invoke_function_uuuuuu(j_calls->instance_ptr, 66, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
12091 }
12092 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
12093         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12094         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
12095         memcpy(txid_arr->elems, *txid, 32);
12096         js_invoke_function_uuuuuu(j_calls->instance_ptr, 67, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
12097 }
12098 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
12099         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12100         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12101         memcpy(header_arr->elems, *header, 80);
12102         int32_t height_conv = height;
12103         js_invoke_function_uuuuuu(j_calls->instance_ptr, 68, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
12104 }
12105 LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
12106         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12107         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 69, 0, 0, 0, 0, 0, 0);
12108         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_constr;
12109         ret_constr.datalen = ret->arr_len;
12110         if (ret_constr.datalen > 0)
12111                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
12112         else
12113                 ret_constr.data = NULL;
12114         uint64_t* ret_vals = ret->elems;
12115         for (size_t x = 0; x < ret_constr.datalen; x++) {
12116                 uint64_t ret_conv_49 = ret_vals[x];
12117                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
12118                 CHECK_ACCESS(ret_conv_49_ptr);
12119                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(ret_conv_49_ptr);
12120                 FREE(untag_ptr(ret_conv_49));
12121                 ret_constr.data[x] = ret_conv_49_conv;
12122         }
12123         FREE(ret);
12124         return ret_constr;
12125 }
12126 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
12127         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
12128         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12129 }
12130 static inline LDKConfirm LDKConfirm_init (JSValue o) {
12131         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
12132         atomic_init(&calls->refcnt, 1);
12133         calls->instance_ptr = o;
12134
12135         LDKConfirm ret = {
12136                 .this_arg = (void*) calls,
12137                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
12138                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
12139                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
12140                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
12141                 .free = LDKConfirm_JCalls_free,
12142         };
12143         return ret;
12144 }
12145 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
12146         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
12147         *res_ptr = LDKConfirm_init(o);
12148         return tag_ptr(res_ptr, true);
12149 }
12150 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) {
12151         void* this_arg_ptr = untag_ptr(this_arg);
12152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12153         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12154         uint8_t header_arr[80];
12155         CHECK(header->arr_len == 80);
12156         memcpy(header_arr, header->elems, 80); FREE(header);
12157         uint8_t (*header_ref)[80] = &header_arr;
12158         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12159         txdata_constr.datalen = txdata->arr_len;
12160         if (txdata_constr.datalen > 0)
12161                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12162         else
12163                 txdata_constr.data = NULL;
12164         uint64_t* txdata_vals = txdata->elems;
12165         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12166                 uint64_t txdata_conv_28 = txdata_vals[c];
12167                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12168                 CHECK_ACCESS(txdata_conv_28_ptr);
12169                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12170                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12171                 txdata_constr.data[c] = txdata_conv_28_conv;
12172         }
12173         FREE(txdata);
12174         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12175 }
12176
12177 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
12178         void* this_arg_ptr = untag_ptr(this_arg);
12179         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12180         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12181         uint8_t txid_arr[32];
12182         CHECK(txid->arr_len == 32);
12183         memcpy(txid_arr, txid->elems, 32); FREE(txid);
12184         uint8_t (*txid_ref)[32] = &txid_arr;
12185         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
12186 }
12187
12188 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
12189         void* this_arg_ptr = untag_ptr(this_arg);
12190         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12191         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12192         uint8_t header_arr[80];
12193         CHECK(header->arr_len == 80);
12194         memcpy(header_arr, header->elems, 80); FREE(header);
12195         uint8_t (*header_ref)[80] = &header_arr;
12196         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
12197 }
12198
12199 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
12200         void* this_arg_ptr = untag_ptr(this_arg);
12201         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12202         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12203         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
12204         uint64_tArray ret_arr = NULL;
12205         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12206         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12207         for (size_t x = 0; x < ret_var.datalen; x++) {
12208                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
12209                 *ret_conv_49_conv = ret_var.data[x];
12210                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
12211         }
12212         
12213         FREE(ret_var.data);
12214         return ret_arr;
12215 }
12216
12217 typedef struct LDKEventHandler_JCalls {
12218         atomic_size_t refcnt;
12219         uint32_t instance_ptr;
12220 } LDKEventHandler_JCalls;
12221 static void LDKEventHandler_JCalls_free(void* this_arg) {
12222         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
12223         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12224                 FREE(j_calls);
12225         }
12226 }
12227 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
12228         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
12229         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12230         *event_copy = event;
12231         uint64_t event_ref = tag_ptr(event_copy, true);
12232         js_invoke_function_buuuuu(j_calls->instance_ptr, 70, event_ref, 0, 0, 0, 0, 0);
12233 }
12234 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
12235         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
12236         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12237 }
12238 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
12239         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
12240         atomic_init(&calls->refcnt, 1);
12241         calls->instance_ptr = o;
12242
12243         LDKEventHandler ret = {
12244                 .this_arg = (void*) calls,
12245                 .handle_event = handle_event_LDKEventHandler_jcall,
12246                 .free = LDKEventHandler_JCalls_free,
12247         };
12248         return ret;
12249 }
12250 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
12251         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12252         *res_ptr = LDKEventHandler_init(o);
12253         return tag_ptr(res_ptr, true);
12254 }
12255 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
12256         void* this_arg_ptr = untag_ptr(this_arg);
12257         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12258         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
12259         void* event_ptr = untag_ptr(event);
12260         CHECK_ACCESS(event_ptr);
12261         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
12262         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
12263         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
12264 }
12265
12266 typedef struct LDKEventsProvider_JCalls {
12267         atomic_size_t refcnt;
12268         uint32_t instance_ptr;
12269 } LDKEventsProvider_JCalls;
12270 static void LDKEventsProvider_JCalls_free(void* this_arg) {
12271         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12272         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12273                 FREE(j_calls);
12274         }
12275 }
12276 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
12277         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12278         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12279         *handler_ret = handler;
12280         js_invoke_function_buuuuu(j_calls->instance_ptr, 71, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
12281 }
12282 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
12283         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
12284         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12285 }
12286 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
12287         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
12288         atomic_init(&calls->refcnt, 1);
12289         calls->instance_ptr = o;
12290
12291         LDKEventsProvider ret = {
12292                 .this_arg = (void*) calls,
12293                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
12294                 .free = LDKEventsProvider_JCalls_free,
12295         };
12296         return ret;
12297 }
12298 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
12299         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12300         *res_ptr = LDKEventsProvider_init(o);
12301         return tag_ptr(res_ptr, true);
12302 }
12303 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
12304         void* this_arg_ptr = untag_ptr(this_arg);
12305         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12306         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
12307         void* handler_ptr = untag_ptr(handler);
12308         CHECK_ACCESS(handler_ptr);
12309         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
12310         if (handler_conv.free == LDKEventHandler_JCalls_free) {
12311                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12312                 LDKEventHandler_JCalls_cloned(&handler_conv);
12313         }
12314         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
12315 }
12316
12317 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
12318         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
12319         switch(obj->tag) {
12320                 case LDKFailureCode_TemporaryNodeFailure: return 0;
12321                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
12322                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
12323                 case LDKFailureCode_InvalidOnionPayload: return 3;
12324                 default: abort();
12325         }
12326 }
12327 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
12328         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
12329         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
12330                         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
12331         return invalid_onion_payload_ref;
12332 }
12333 typedef struct LDKMessageSendEventsProvider_JCalls {
12334         atomic_size_t refcnt;
12335         uint32_t instance_ptr;
12336 } LDKMessageSendEventsProvider_JCalls;
12337 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
12338         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
12339         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12340                 FREE(j_calls);
12341         }
12342 }
12343 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
12344         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
12345         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, 0, 0, 0, 0, 0, 0);
12346         LDKCVec_MessageSendEventZ ret_constr;
12347         ret_constr.datalen = ret->arr_len;
12348         if (ret_constr.datalen > 0)
12349                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12350         else
12351                 ret_constr.data = NULL;
12352         uint64_t* ret_vals = ret->elems;
12353         for (size_t s = 0; s < ret_constr.datalen; s++) {
12354                 uint64_t ret_conv_18 = ret_vals[s];
12355                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
12356                 CHECK_ACCESS(ret_conv_18_ptr);
12357                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
12358                 FREE(untag_ptr(ret_conv_18));
12359                 ret_constr.data[s] = ret_conv_18_conv;
12360         }
12361         FREE(ret);
12362         return ret_constr;
12363 }
12364 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
12365         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
12366         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12367 }
12368 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
12369         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
12370         atomic_init(&calls->refcnt, 1);
12371         calls->instance_ptr = o;
12372
12373         LDKMessageSendEventsProvider ret = {
12374                 .this_arg = (void*) calls,
12375                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
12376                 .free = LDKMessageSendEventsProvider_JCalls_free,
12377         };
12378         return ret;
12379 }
12380 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
12381         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
12382         *res_ptr = LDKMessageSendEventsProvider_init(o);
12383         return tag_ptr(res_ptr, true);
12384 }
12385 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) {
12386         void* this_arg_ptr = untag_ptr(this_arg);
12387         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12388         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
12389         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
12390         uint64_tArray ret_arr = NULL;
12391         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12392         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12393         for (size_t s = 0; s < ret_var.datalen; s++) {
12394                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12395                 *ret_conv_18_copy = ret_var.data[s];
12396                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
12397                 ret_arr_ptr[s] = ret_conv_18_ref;
12398         }
12399         
12400         FREE(ret_var.data);
12401         return ret_arr;
12402 }
12403
12404 typedef struct LDKChannelMessageHandler_JCalls {
12405         atomic_size_t refcnt;
12406         uint32_t instance_ptr;
12407         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12408 } LDKChannelMessageHandler_JCalls;
12409 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
12410         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12411         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12412                 FREE(j_calls);
12413         }
12414 }
12415 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
12416         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12417         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12418         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12419         LDKOpenChannel msg_var = *msg;
12420         uint64_t msg_ref = 0;
12421         msg_var = OpenChannel_clone(&msg_var);
12422         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12423         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12424         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12425 }
12426 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
12427         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12428         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12429         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12430         LDKOpenChannelV2 msg_var = *msg;
12431         uint64_t msg_ref = 0;
12432         msg_var = OpenChannelV2_clone(&msg_var);
12433         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12434         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12435         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12436 }
12437 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
12438         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12439         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12440         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12441         LDKAcceptChannel msg_var = *msg;
12442         uint64_t msg_ref = 0;
12443         msg_var = AcceptChannel_clone(&msg_var);
12444         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12445         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12446         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12447 }
12448 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
12449         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12450         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12451         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12452         LDKAcceptChannelV2 msg_var = *msg;
12453         uint64_t msg_ref = 0;
12454         msg_var = AcceptChannelV2_clone(&msg_var);
12455         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12456         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12457         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12458 }
12459 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
12460         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12461         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12462         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12463         LDKFundingCreated msg_var = *msg;
12464         uint64_t msg_ref = 0;
12465         msg_var = FundingCreated_clone(&msg_var);
12466         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12467         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12468         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12469 }
12470 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
12471         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12472         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12473         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12474         LDKFundingSigned msg_var = *msg;
12475         uint64_t msg_ref = 0;
12476         msg_var = FundingSigned_clone(&msg_var);
12477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12478         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12479         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12480 }
12481 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
12482         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12483         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12484         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12485         LDKChannelReady msg_var = *msg;
12486         uint64_t msg_ref = 0;
12487         msg_var = ChannelReady_clone(&msg_var);
12488         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12489         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12490         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12491 }
12492 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
12493         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12494         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12495         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12496         LDKShutdown msg_var = *msg;
12497         uint64_t msg_ref = 0;
12498         msg_var = Shutdown_clone(&msg_var);
12499         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12500         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12501         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12502 }
12503 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
12504         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12505         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12506         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12507         LDKClosingSigned msg_var = *msg;
12508         uint64_t msg_ref = 0;
12509         msg_var = ClosingSigned_clone(&msg_var);
12510         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12511         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12512         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12513 }
12514 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
12515         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12516         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12517         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12518         LDKTxAddInput msg_var = *msg;
12519         uint64_t msg_ref = 0;
12520         msg_var = TxAddInput_clone(&msg_var);
12521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12522         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12523         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12524 }
12525 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
12526         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12527         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12528         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12529         LDKTxAddOutput msg_var = *msg;
12530         uint64_t msg_ref = 0;
12531         msg_var = TxAddOutput_clone(&msg_var);
12532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12533         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12534         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12535 }
12536 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
12537         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12538         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12539         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12540         LDKTxRemoveInput msg_var = *msg;
12541         uint64_t msg_ref = 0;
12542         msg_var = TxRemoveInput_clone(&msg_var);
12543         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12544         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12545         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12546 }
12547 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
12548         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12549         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12550         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12551         LDKTxRemoveOutput msg_var = *msg;
12552         uint64_t msg_ref = 0;
12553         msg_var = TxRemoveOutput_clone(&msg_var);
12554         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12555         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12556         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12557 }
12558 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
12559         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12560         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12561         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12562         LDKTxComplete msg_var = *msg;
12563         uint64_t msg_ref = 0;
12564         msg_var = TxComplete_clone(&msg_var);
12565         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12566         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12567         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12568 }
12569 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
12570         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12571         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12572         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12573         LDKTxSignatures msg_var = *msg;
12574         uint64_t msg_ref = 0;
12575         msg_var = TxSignatures_clone(&msg_var);
12576         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12577         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12578         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12579 }
12580 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
12581         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12582         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12583         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12584         LDKTxInitRbf msg_var = *msg;
12585         uint64_t msg_ref = 0;
12586         msg_var = TxInitRbf_clone(&msg_var);
12587         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12588         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12589         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12590 }
12591 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
12592         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12593         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12594         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12595         LDKTxAckRbf msg_var = *msg;
12596         uint64_t msg_ref = 0;
12597         msg_var = TxAckRbf_clone(&msg_var);
12598         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12599         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12600         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12601 }
12602 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
12603         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12604         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12605         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12606         LDKTxAbort msg_var = *msg;
12607         uint64_t msg_ref = 0;
12608         msg_var = TxAbort_clone(&msg_var);
12609         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12610         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12611         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12612 }
12613 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
12614         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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         LDKUpdateAddHTLC msg_var = *msg;
12618         uint64_t msg_ref = 0;
12619         msg_var = UpdateAddHTLC_clone(&msg_var);
12620         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12621         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12622         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12623 }
12624 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
12625         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12626         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12627         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12628         LDKUpdateFulfillHTLC msg_var = *msg;
12629         uint64_t msg_ref = 0;
12630         msg_var = UpdateFulfillHTLC_clone(&msg_var);
12631         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12632         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12633         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12634 }
12635 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
12636         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12637         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12638         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12639         LDKUpdateFailHTLC msg_var = *msg;
12640         uint64_t msg_ref = 0;
12641         msg_var = UpdateFailHTLC_clone(&msg_var);
12642         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12643         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12644         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12645 }
12646 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
12647         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12648         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12649         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12650         LDKUpdateFailMalformedHTLC msg_var = *msg;
12651         uint64_t msg_ref = 0;
12652         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
12653         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12654         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12655         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12656 }
12657 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
12658         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12659         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12660         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12661         LDKCommitmentSigned msg_var = *msg;
12662         uint64_t msg_ref = 0;
12663         msg_var = CommitmentSigned_clone(&msg_var);
12664         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12665         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12666         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12667 }
12668 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
12669         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12670         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12671         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12672         LDKRevokeAndACK msg_var = *msg;
12673         uint64_t msg_ref = 0;
12674         msg_var = RevokeAndACK_clone(&msg_var);
12675         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12676         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12677         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12678 }
12679 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
12680         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12681         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12682         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12683         LDKUpdateFee msg_var = *msg;
12684         uint64_t msg_ref = 0;
12685         msg_var = UpdateFee_clone(&msg_var);
12686         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12687         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12688         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12689 }
12690 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
12691         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12692         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12693         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12694         LDKAnnouncementSignatures msg_var = *msg;
12695         uint64_t msg_ref = 0;
12696         msg_var = AnnouncementSignatures_clone(&msg_var);
12697         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12698         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12699         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12700 }
12701 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12702         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12703         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12704         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12705         js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
12706 }
12707 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
12708         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12709         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12710         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12711         LDKInit msg_var = *msg;
12712         uint64_t msg_ref = 0;
12713         msg_var = Init_clone(&msg_var);
12714         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12715         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12716         jboolean inbound_conv = inbound;
12717         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
12718         void* ret_ptr = untag_ptr(ret);
12719         CHECK_ACCESS(ret_ptr);
12720         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
12721         FREE(untag_ptr(ret));
12722         return ret_conv;
12723 }
12724 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12725         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12726         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12727         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12728         LDKChannelReestablish msg_var = *msg;
12729         uint64_t msg_ref = 0;
12730         msg_var = ChannelReestablish_clone(&msg_var);
12731         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12732         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12733         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12734 }
12735 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12736         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12737         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12738         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12739         LDKChannelUpdate msg_var = *msg;
12740         uint64_t msg_ref = 0;
12741         msg_var = ChannelUpdate_clone(&msg_var);
12742         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12743         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12744         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12745 }
12746 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12747         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12748         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12749         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12750         LDKErrorMessage msg_var = *msg;
12751         uint64_t msg_ref = 0;
12752         msg_var = ErrorMessage_clone(&msg_var);
12753         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12754         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12755         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12756 }
12757 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
12758         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12759         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, 0, 0, 0, 0, 0, 0);
12760         LDKNodeFeatures ret_conv;
12761         ret_conv.inner = untag_ptr(ret);
12762         ret_conv.is_owned = ptr_is_owned(ret);
12763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12764         return ret_conv;
12765 }
12766 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12767         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12768         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12769         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12770         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
12771         LDKInitFeatures ret_conv;
12772         ret_conv.inner = untag_ptr(ret);
12773         ret_conv.is_owned = ptr_is_owned(ret);
12774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12775         return ret_conv;
12776 }
12777 LDKCOption_CVec_ThirtyTwoBytesZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
12778         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12779         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0);
12780         void* ret_ptr = untag_ptr(ret);
12781         CHECK_ACCESS(ret_ptr);
12782         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
12783         FREE(untag_ptr(ret));
12784         return ret_conv;
12785 }
12786 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
12787         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
12788         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12789         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12790 }
12791 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
12792         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
12793         atomic_init(&calls->refcnt, 1);
12794         calls->instance_ptr = o;
12795
12796         LDKChannelMessageHandler ret = {
12797                 .this_arg = (void*) calls,
12798                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
12799                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
12800                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
12801                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
12802                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12803                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12804                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12805                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12806                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12807                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
12808                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
12809                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
12810                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
12811                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
12812                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
12813                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
12814                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
12815                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
12816                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12817                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12818                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12819                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12820                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12821                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12822                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12823                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12824                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12825                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12826                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12827                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12828                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12829                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
12830                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
12831                 .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall,
12832                 .free = LDKChannelMessageHandler_JCalls_free,
12833                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
12834         };
12835         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12836         return ret;
12837 }
12838 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
12839         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12840         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
12841         return tag_ptr(res_ptr, true);
12842 }
12843 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) {
12844         void* this_arg_ptr = untag_ptr(this_arg);
12845         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12846         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12847         LDKPublicKey their_node_id_ref;
12848         CHECK(their_node_id->arr_len == 33);
12849         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12850         LDKOpenChannel msg_conv;
12851         msg_conv.inner = untag_ptr(msg);
12852         msg_conv.is_owned = ptr_is_owned(msg);
12853         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12854         msg_conv.is_owned = false;
12855         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12856 }
12857
12858 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) {
12859         void* this_arg_ptr = untag_ptr(this_arg);
12860         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12861         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12862         LDKPublicKey their_node_id_ref;
12863         CHECK(their_node_id->arr_len == 33);
12864         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12865         LDKOpenChannelV2 msg_conv;
12866         msg_conv.inner = untag_ptr(msg);
12867         msg_conv.is_owned = ptr_is_owned(msg);
12868         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12869         msg_conv.is_owned = false;
12870         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12871 }
12872
12873 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) {
12874         void* this_arg_ptr = untag_ptr(this_arg);
12875         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12876         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12877         LDKPublicKey their_node_id_ref;
12878         CHECK(their_node_id->arr_len == 33);
12879         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12880         LDKAcceptChannel msg_conv;
12881         msg_conv.inner = untag_ptr(msg);
12882         msg_conv.is_owned = ptr_is_owned(msg);
12883         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12884         msg_conv.is_owned = false;
12885         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12886 }
12887
12888 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) {
12889         void* this_arg_ptr = untag_ptr(this_arg);
12890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12891         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12892         LDKPublicKey their_node_id_ref;
12893         CHECK(their_node_id->arr_len == 33);
12894         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12895         LDKAcceptChannelV2 msg_conv;
12896         msg_conv.inner = untag_ptr(msg);
12897         msg_conv.is_owned = ptr_is_owned(msg);
12898         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12899         msg_conv.is_owned = false;
12900         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12901 }
12902
12903 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) {
12904         void* this_arg_ptr = untag_ptr(this_arg);
12905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12906         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12907         LDKPublicKey their_node_id_ref;
12908         CHECK(their_node_id->arr_len == 33);
12909         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12910         LDKFundingCreated msg_conv;
12911         msg_conv.inner = untag_ptr(msg);
12912         msg_conv.is_owned = ptr_is_owned(msg);
12913         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12914         msg_conv.is_owned = false;
12915         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12916 }
12917
12918 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) {
12919         void* this_arg_ptr = untag_ptr(this_arg);
12920         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12921         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12922         LDKPublicKey their_node_id_ref;
12923         CHECK(their_node_id->arr_len == 33);
12924         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12925         LDKFundingSigned msg_conv;
12926         msg_conv.inner = untag_ptr(msg);
12927         msg_conv.is_owned = ptr_is_owned(msg);
12928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12929         msg_conv.is_owned = false;
12930         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12931 }
12932
12933 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) {
12934         void* this_arg_ptr = untag_ptr(this_arg);
12935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12936         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12937         LDKPublicKey their_node_id_ref;
12938         CHECK(their_node_id->arr_len == 33);
12939         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12940         LDKChannelReady msg_conv;
12941         msg_conv.inner = untag_ptr(msg);
12942         msg_conv.is_owned = ptr_is_owned(msg);
12943         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12944         msg_conv.is_owned = false;
12945         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12946 }
12947
12948 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
12949         void* this_arg_ptr = untag_ptr(this_arg);
12950         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12951         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12952         LDKPublicKey their_node_id_ref;
12953         CHECK(their_node_id->arr_len == 33);
12954         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12955         LDKShutdown msg_conv;
12956         msg_conv.inner = untag_ptr(msg);
12957         msg_conv.is_owned = ptr_is_owned(msg);
12958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12959         msg_conv.is_owned = false;
12960         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12961 }
12962
12963 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) {
12964         void* this_arg_ptr = untag_ptr(this_arg);
12965         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12966         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12967         LDKPublicKey their_node_id_ref;
12968         CHECK(their_node_id->arr_len == 33);
12969         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12970         LDKClosingSigned msg_conv;
12971         msg_conv.inner = untag_ptr(msg);
12972         msg_conv.is_owned = ptr_is_owned(msg);
12973         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12974         msg_conv.is_owned = false;
12975         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12976 }
12977
12978 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) {
12979         void* this_arg_ptr = untag_ptr(this_arg);
12980         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12981         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12982         LDKPublicKey their_node_id_ref;
12983         CHECK(their_node_id->arr_len == 33);
12984         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12985         LDKTxAddInput msg_conv;
12986         msg_conv.inner = untag_ptr(msg);
12987         msg_conv.is_owned = ptr_is_owned(msg);
12988         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12989         msg_conv.is_owned = false;
12990         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12991 }
12992
12993 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) {
12994         void* this_arg_ptr = untag_ptr(this_arg);
12995         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12996         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12997         LDKPublicKey their_node_id_ref;
12998         CHECK(their_node_id->arr_len == 33);
12999         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13000         LDKTxAddOutput msg_conv;
13001         msg_conv.inner = untag_ptr(msg);
13002         msg_conv.is_owned = ptr_is_owned(msg);
13003         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13004         msg_conv.is_owned = false;
13005         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13006 }
13007
13008 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) {
13009         void* this_arg_ptr = untag_ptr(this_arg);
13010         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13011         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13012         LDKPublicKey their_node_id_ref;
13013         CHECK(their_node_id->arr_len == 33);
13014         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13015         LDKTxRemoveInput msg_conv;
13016         msg_conv.inner = untag_ptr(msg);
13017         msg_conv.is_owned = ptr_is_owned(msg);
13018         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13019         msg_conv.is_owned = false;
13020         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13021 }
13022
13023 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) {
13024         void* this_arg_ptr = untag_ptr(this_arg);
13025         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13026         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13027         LDKPublicKey their_node_id_ref;
13028         CHECK(their_node_id->arr_len == 33);
13029         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13030         LDKTxRemoveOutput msg_conv;
13031         msg_conv.inner = untag_ptr(msg);
13032         msg_conv.is_owned = ptr_is_owned(msg);
13033         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13034         msg_conv.is_owned = false;
13035         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13036 }
13037
13038 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) {
13039         void* this_arg_ptr = untag_ptr(this_arg);
13040         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13041         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13042         LDKPublicKey their_node_id_ref;
13043         CHECK(their_node_id->arr_len == 33);
13044         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13045         LDKTxComplete msg_conv;
13046         msg_conv.inner = untag_ptr(msg);
13047         msg_conv.is_owned = ptr_is_owned(msg);
13048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13049         msg_conv.is_owned = false;
13050         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13051 }
13052
13053 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) {
13054         void* this_arg_ptr = untag_ptr(this_arg);
13055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13056         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13057         LDKPublicKey their_node_id_ref;
13058         CHECK(their_node_id->arr_len == 33);
13059         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13060         LDKTxSignatures msg_conv;
13061         msg_conv.inner = untag_ptr(msg);
13062         msg_conv.is_owned = ptr_is_owned(msg);
13063         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13064         msg_conv.is_owned = false;
13065         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13066 }
13067
13068 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) {
13069         void* this_arg_ptr = untag_ptr(this_arg);
13070         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13071         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13072         LDKPublicKey their_node_id_ref;
13073         CHECK(their_node_id->arr_len == 33);
13074         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13075         LDKTxInitRbf msg_conv;
13076         msg_conv.inner = untag_ptr(msg);
13077         msg_conv.is_owned = ptr_is_owned(msg);
13078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13079         msg_conv.is_owned = false;
13080         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13081 }
13082
13083 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) {
13084         void* this_arg_ptr = untag_ptr(this_arg);
13085         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13086         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13087         LDKPublicKey their_node_id_ref;
13088         CHECK(their_node_id->arr_len == 33);
13089         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13090         LDKTxAckRbf msg_conv;
13091         msg_conv.inner = untag_ptr(msg);
13092         msg_conv.is_owned = ptr_is_owned(msg);
13093         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13094         msg_conv.is_owned = false;
13095         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13096 }
13097
13098 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) {
13099         void* this_arg_ptr = untag_ptr(this_arg);
13100         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13101         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13102         LDKPublicKey their_node_id_ref;
13103         CHECK(their_node_id->arr_len == 33);
13104         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13105         LDKTxAbort msg_conv;
13106         msg_conv.inner = untag_ptr(msg);
13107         msg_conv.is_owned = ptr_is_owned(msg);
13108         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13109         msg_conv.is_owned = false;
13110         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13111 }
13112
13113 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) {
13114         void* this_arg_ptr = untag_ptr(this_arg);
13115         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13116         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13117         LDKPublicKey their_node_id_ref;
13118         CHECK(their_node_id->arr_len == 33);
13119         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13120         LDKUpdateAddHTLC msg_conv;
13121         msg_conv.inner = untag_ptr(msg);
13122         msg_conv.is_owned = ptr_is_owned(msg);
13123         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13124         msg_conv.is_owned = false;
13125         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13126 }
13127
13128 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) {
13129         void* this_arg_ptr = untag_ptr(this_arg);
13130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13131         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13132         LDKPublicKey their_node_id_ref;
13133         CHECK(their_node_id->arr_len == 33);
13134         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13135         LDKUpdateFulfillHTLC msg_conv;
13136         msg_conv.inner = untag_ptr(msg);
13137         msg_conv.is_owned = ptr_is_owned(msg);
13138         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13139         msg_conv.is_owned = false;
13140         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13141 }
13142
13143 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) {
13144         void* this_arg_ptr = untag_ptr(this_arg);
13145         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13146         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13147         LDKPublicKey their_node_id_ref;
13148         CHECK(their_node_id->arr_len == 33);
13149         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13150         LDKUpdateFailHTLC msg_conv;
13151         msg_conv.inner = untag_ptr(msg);
13152         msg_conv.is_owned = ptr_is_owned(msg);
13153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13154         msg_conv.is_owned = false;
13155         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13156 }
13157
13158 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) {
13159         void* this_arg_ptr = untag_ptr(this_arg);
13160         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13161         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13162         LDKPublicKey their_node_id_ref;
13163         CHECK(their_node_id->arr_len == 33);
13164         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13165         LDKUpdateFailMalformedHTLC msg_conv;
13166         msg_conv.inner = untag_ptr(msg);
13167         msg_conv.is_owned = ptr_is_owned(msg);
13168         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13169         msg_conv.is_owned = false;
13170         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13171 }
13172
13173 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) {
13174         void* this_arg_ptr = untag_ptr(this_arg);
13175         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13176         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13177         LDKPublicKey their_node_id_ref;
13178         CHECK(their_node_id->arr_len == 33);
13179         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13180         LDKCommitmentSigned msg_conv;
13181         msg_conv.inner = untag_ptr(msg);
13182         msg_conv.is_owned = ptr_is_owned(msg);
13183         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13184         msg_conv.is_owned = false;
13185         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13186 }
13187
13188 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) {
13189         void* this_arg_ptr = untag_ptr(this_arg);
13190         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13191         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13192         LDKPublicKey their_node_id_ref;
13193         CHECK(their_node_id->arr_len == 33);
13194         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13195         LDKRevokeAndACK msg_conv;
13196         msg_conv.inner = untag_ptr(msg);
13197         msg_conv.is_owned = ptr_is_owned(msg);
13198         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13199         msg_conv.is_owned = false;
13200         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13201 }
13202
13203 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) {
13204         void* this_arg_ptr = untag_ptr(this_arg);
13205         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13206         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13207         LDKPublicKey their_node_id_ref;
13208         CHECK(their_node_id->arr_len == 33);
13209         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13210         LDKUpdateFee msg_conv;
13211         msg_conv.inner = untag_ptr(msg);
13212         msg_conv.is_owned = ptr_is_owned(msg);
13213         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13214         msg_conv.is_owned = false;
13215         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13216 }
13217
13218 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) {
13219         void* this_arg_ptr = untag_ptr(this_arg);
13220         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13221         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13222         LDKPublicKey their_node_id_ref;
13223         CHECK(their_node_id->arr_len == 33);
13224         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13225         LDKAnnouncementSignatures msg_conv;
13226         msg_conv.inner = untag_ptr(msg);
13227         msg_conv.is_owned = ptr_is_owned(msg);
13228         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13229         msg_conv.is_owned = false;
13230         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13231 }
13232
13233 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
13234         void* this_arg_ptr = untag_ptr(this_arg);
13235         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13236         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13237         LDKPublicKey their_node_id_ref;
13238         CHECK(their_node_id->arr_len == 33);
13239         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13240         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13241 }
13242
13243 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) {
13244         void* this_arg_ptr = untag_ptr(this_arg);
13245         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13246         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13247         LDKPublicKey their_node_id_ref;
13248         CHECK(their_node_id->arr_len == 33);
13249         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13250         LDKInit msg_conv;
13251         msg_conv.inner = untag_ptr(msg);
13252         msg_conv.is_owned = ptr_is_owned(msg);
13253         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13254         msg_conv.is_owned = false;
13255         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13256         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
13257         return tag_ptr(ret_conv, true);
13258 }
13259
13260 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) {
13261         void* this_arg_ptr = untag_ptr(this_arg);
13262         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13263         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13264         LDKPublicKey their_node_id_ref;
13265         CHECK(their_node_id->arr_len == 33);
13266         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13267         LDKChannelReestablish msg_conv;
13268         msg_conv.inner = untag_ptr(msg);
13269         msg_conv.is_owned = ptr_is_owned(msg);
13270         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13271         msg_conv.is_owned = false;
13272         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13273 }
13274
13275 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) {
13276         void* this_arg_ptr = untag_ptr(this_arg);
13277         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13278         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13279         LDKPublicKey their_node_id_ref;
13280         CHECK(their_node_id->arr_len == 33);
13281         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13282         LDKChannelUpdate msg_conv;
13283         msg_conv.inner = untag_ptr(msg);
13284         msg_conv.is_owned = ptr_is_owned(msg);
13285         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13286         msg_conv.is_owned = false;
13287         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13288 }
13289
13290 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13291         void* this_arg_ptr = untag_ptr(this_arg);
13292         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13293         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13294         LDKPublicKey their_node_id_ref;
13295         CHECK(their_node_id->arr_len == 33);
13296         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13297         LDKErrorMessage msg_conv;
13298         msg_conv.inner = untag_ptr(msg);
13299         msg_conv.is_owned = ptr_is_owned(msg);
13300         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13301         msg_conv.is_owned = false;
13302         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13303 }
13304
13305 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
13306         void* this_arg_ptr = untag_ptr(this_arg);
13307         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13308         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13309         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13310         uint64_t ret_ref = 0;
13311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13313         return ret_ref;
13314 }
13315
13316 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13317         void* this_arg_ptr = untag_ptr(this_arg);
13318         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13319         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13320         LDKPublicKey their_node_id_ref;
13321         CHECK(their_node_id->arr_len == 33);
13322         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13323         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13324         uint64_t ret_ref = 0;
13325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13327         return ret_ref;
13328 }
13329
13330 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_genesis_hashes"))) TS_ChannelMessageHandler_get_genesis_hashes(uint64_t this_arg) {
13331         void* this_arg_ptr = untag_ptr(this_arg);
13332         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13333         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13334         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
13335         *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg);
13336         uint64_t ret_ref = tag_ptr(ret_copy, true);
13337         return ret_ref;
13338 }
13339
13340 typedef struct LDKRoutingMessageHandler_JCalls {
13341         atomic_size_t refcnt;
13342         uint32_t instance_ptr;
13343         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
13344 } LDKRoutingMessageHandler_JCalls;
13345 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
13346         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13347         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13348                 FREE(j_calls);
13349         }
13350 }
13351 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
13352         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13353         LDKNodeAnnouncement msg_var = *msg;
13354         uint64_t msg_ref = 0;
13355         msg_var = NodeAnnouncement_clone(&msg_var);
13356         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13357         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13358         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 107, msg_ref, 0, 0, 0, 0, 0);
13359         void* ret_ptr = untag_ptr(ret);
13360         CHECK_ACCESS(ret_ptr);
13361         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13362         FREE(untag_ptr(ret));
13363         return ret_conv;
13364 }
13365 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
13366         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13367         LDKChannelAnnouncement msg_var = *msg;
13368         uint64_t msg_ref = 0;
13369         msg_var = ChannelAnnouncement_clone(&msg_var);
13370         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13371         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13372         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 108, msg_ref, 0, 0, 0, 0, 0);
13373         void* ret_ptr = untag_ptr(ret);
13374         CHECK_ACCESS(ret_ptr);
13375         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13376         FREE(untag_ptr(ret));
13377         return ret_conv;
13378 }
13379 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
13380         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13381         LDKChannelUpdate msg_var = *msg;
13382         uint64_t msg_ref = 0;
13383         msg_var = ChannelUpdate_clone(&msg_var);
13384         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13385         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13386         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 109, msg_ref, 0, 0, 0, 0, 0);
13387         void* ret_ptr = untag_ptr(ret);
13388         CHECK_ACCESS(ret_ptr);
13389         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13390         FREE(untag_ptr(ret));
13391         return ret_conv;
13392 }
13393 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
13394         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13395         int64_t starting_point_conv = starting_point;
13396         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 110, starting_point_conv, 0, 0, 0, 0, 0);
13397         void* ret_ptr = untag_ptr(ret);
13398         CHECK_ACCESS(ret_ptr);
13399         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
13400         FREE(untag_ptr(ret));
13401         return ret_conv;
13402 }
13403 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
13404         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13405         LDKNodeId starting_point_var = starting_point;
13406         uint64_t starting_point_ref = 0;
13407         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
13408         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
13409         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, starting_point_ref, 0, 0, 0, 0, 0);
13410         LDKNodeAnnouncement ret_conv;
13411         ret_conv.inner = untag_ptr(ret);
13412         ret_conv.is_owned = ptr_is_owned(ret);
13413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13414         return ret_conv;
13415 }
13416 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
13417         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13418         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13419         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13420         LDKInit init_var = *init;
13421         uint64_t init_ref = 0;
13422         init_var = Init_clone(&init_var);
13423         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13424         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13425         jboolean inbound_conv = inbound;
13426         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 112, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
13427         void* ret_ptr = untag_ptr(ret);
13428         CHECK_ACCESS(ret_ptr);
13429         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13430         FREE(untag_ptr(ret));
13431         return ret_conv;
13432 }
13433 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
13434         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13435         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13436         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13437         LDKReplyChannelRange msg_var = msg;
13438         uint64_t msg_ref = 0;
13439         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13440         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13441         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 113, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13442         void* ret_ptr = untag_ptr(ret);
13443         CHECK_ACCESS(ret_ptr);
13444         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13445         FREE(untag_ptr(ret));
13446         return ret_conv;
13447 }
13448 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
13449         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13450         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13451         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13452         LDKReplyShortChannelIdsEnd msg_var = msg;
13453         uint64_t msg_ref = 0;
13454         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13455         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13456         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 114, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13457         void* ret_ptr = untag_ptr(ret);
13458         CHECK_ACCESS(ret_ptr);
13459         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13460         FREE(untag_ptr(ret));
13461         return ret_conv;
13462 }
13463 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
13464         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13465         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13466         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13467         LDKQueryChannelRange msg_var = msg;
13468         uint64_t msg_ref = 0;
13469         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13470         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13471         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13472         void* ret_ptr = untag_ptr(ret);
13473         CHECK_ACCESS(ret_ptr);
13474         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13475         FREE(untag_ptr(ret));
13476         return ret_conv;
13477 }
13478 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
13479         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13480         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13481         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13482         LDKQueryShortChannelIds msg_var = msg;
13483         uint64_t msg_ref = 0;
13484         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13485         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13486         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 116, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13487         void* ret_ptr = untag_ptr(ret);
13488         CHECK_ACCESS(ret_ptr);
13489         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13490         FREE(untag_ptr(ret));
13491         return ret_conv;
13492 }
13493 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13494         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13495         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, 0, 0, 0, 0, 0, 0);
13496 }
13497 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13498         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13499         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 118, 0, 0, 0, 0, 0, 0);
13500         LDKNodeFeatures ret_conv;
13501         ret_conv.inner = untag_ptr(ret);
13502         ret_conv.is_owned = ptr_is_owned(ret);
13503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13504         return ret_conv;
13505 }
13506 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13507         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13508         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13509         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13510         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13511         LDKInitFeatures ret_conv;
13512         ret_conv.inner = untag_ptr(ret);
13513         ret_conv.is_owned = ptr_is_owned(ret);
13514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13515         return ret_conv;
13516 }
13517 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
13518         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
13519         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13520         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13521 }
13522 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
13523         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
13524         atomic_init(&calls->refcnt, 1);
13525         calls->instance_ptr = o;
13526
13527         LDKRoutingMessageHandler ret = {
13528                 .this_arg = (void*) calls,
13529                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
13530                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
13531                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
13532                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
13533                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
13534                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
13535                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
13536                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
13537                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
13538                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
13539                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
13540                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
13541                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
13542                 .free = LDKRoutingMessageHandler_JCalls_free,
13543                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
13544         };
13545         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13546         return ret;
13547 }
13548 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
13549         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13550         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
13551         return tag_ptr(res_ptr, true);
13552 }
13553 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
13554         void* this_arg_ptr = untag_ptr(this_arg);
13555         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13556         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13557         LDKNodeAnnouncement msg_conv;
13558         msg_conv.inner = untag_ptr(msg);
13559         msg_conv.is_owned = ptr_is_owned(msg);
13560         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13561         msg_conv.is_owned = false;
13562         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13563         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
13564         return tag_ptr(ret_conv, true);
13565 }
13566
13567 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
13568         void* this_arg_ptr = untag_ptr(this_arg);
13569         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13570         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13571         LDKChannelAnnouncement msg_conv;
13572         msg_conv.inner = untag_ptr(msg);
13573         msg_conv.is_owned = ptr_is_owned(msg);
13574         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13575         msg_conv.is_owned = false;
13576         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13577         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13578         return tag_ptr(ret_conv, true);
13579 }
13580
13581 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
13582         void* this_arg_ptr = untag_ptr(this_arg);
13583         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13584         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13585         LDKChannelUpdate msg_conv;
13586         msg_conv.inner = untag_ptr(msg);
13587         msg_conv.is_owned = ptr_is_owned(msg);
13588         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13589         msg_conv.is_owned = false;
13590         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13591         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13592         return tag_ptr(ret_conv, true);
13593 }
13594
13595 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) {
13596         void* this_arg_ptr = untag_ptr(this_arg);
13597         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13598         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13599         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
13600         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
13601         uint64_t ret_ref = tag_ptr(ret_copy, true);
13602         return ret_ref;
13603 }
13604
13605 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) {
13606         void* this_arg_ptr = untag_ptr(this_arg);
13607         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13608         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13609         LDKNodeId starting_point_conv;
13610         starting_point_conv.inner = untag_ptr(starting_point);
13611         starting_point_conv.is_owned = ptr_is_owned(starting_point);
13612         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
13613         starting_point_conv = NodeId_clone(&starting_point_conv);
13614         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
13615         uint64_t ret_ref = 0;
13616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13618         return ret_ref;
13619 }
13620
13621 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) {
13622         void* this_arg_ptr = untag_ptr(this_arg);
13623         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13624         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13625         LDKPublicKey their_node_id_ref;
13626         CHECK(their_node_id->arr_len == 33);
13627         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13628         LDKInit init_conv;
13629         init_conv.inner = untag_ptr(init);
13630         init_conv.is_owned = ptr_is_owned(init);
13631         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13632         init_conv.is_owned = false;
13633         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13634         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
13635         return tag_ptr(ret_conv, true);
13636 }
13637
13638 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) {
13639         void* this_arg_ptr = untag_ptr(this_arg);
13640         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13641         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13642         LDKPublicKey their_node_id_ref;
13643         CHECK(their_node_id->arr_len == 33);
13644         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13645         LDKReplyChannelRange msg_conv;
13646         msg_conv.inner = untag_ptr(msg);
13647         msg_conv.is_owned = ptr_is_owned(msg);
13648         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13649         msg_conv = ReplyChannelRange_clone(&msg_conv);
13650         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13651         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13652         return tag_ptr(ret_conv, true);
13653 }
13654
13655 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) {
13656         void* this_arg_ptr = untag_ptr(this_arg);
13657         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13658         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13659         LDKPublicKey their_node_id_ref;
13660         CHECK(their_node_id->arr_len == 33);
13661         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13662         LDKReplyShortChannelIdsEnd msg_conv;
13663         msg_conv.inner = untag_ptr(msg);
13664         msg_conv.is_owned = ptr_is_owned(msg);
13665         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13666         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
13667         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13668         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13669         return tag_ptr(ret_conv, true);
13670 }
13671
13672 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) {
13673         void* this_arg_ptr = untag_ptr(this_arg);
13674         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13675         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13676         LDKPublicKey their_node_id_ref;
13677         CHECK(their_node_id->arr_len == 33);
13678         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13679         LDKQueryChannelRange msg_conv;
13680         msg_conv.inner = untag_ptr(msg);
13681         msg_conv.is_owned = ptr_is_owned(msg);
13682         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13683         msg_conv = QueryChannelRange_clone(&msg_conv);
13684         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13685         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13686         return tag_ptr(ret_conv, true);
13687 }
13688
13689 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) {
13690         void* this_arg_ptr = untag_ptr(this_arg);
13691         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13692         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13693         LDKPublicKey their_node_id_ref;
13694         CHECK(their_node_id->arr_len == 33);
13695         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13696         LDKQueryShortChannelIds msg_conv;
13697         msg_conv.inner = untag_ptr(msg);
13698         msg_conv.is_owned = ptr_is_owned(msg);
13699         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13700         msg_conv = QueryShortChannelIds_clone(&msg_conv);
13701         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13702         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13703         return tag_ptr(ret_conv, true);
13704 }
13705
13706 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
13707         void* this_arg_ptr = untag_ptr(this_arg);
13708         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13709         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13710         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
13711         return ret_conv;
13712 }
13713
13714 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
13715         void* this_arg_ptr = untag_ptr(this_arg);
13716         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13717         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13718         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13719         uint64_t ret_ref = 0;
13720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13722         return ret_ref;
13723 }
13724
13725 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13726         void* this_arg_ptr = untag_ptr(this_arg);
13727         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13728         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13729         LDKPublicKey their_node_id_ref;
13730         CHECK(their_node_id->arr_len == 33);
13731         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13732         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13733         uint64_t ret_ref = 0;
13734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13736         return ret_ref;
13737 }
13738
13739 typedef struct LDKOnionMessageProvider_JCalls {
13740         atomic_size_t refcnt;
13741         uint32_t instance_ptr;
13742 } LDKOnionMessageProvider_JCalls;
13743 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
13744         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
13745         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13746                 FREE(j_calls);
13747         }
13748 }
13749 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
13750         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
13751         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
13752         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
13753         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
13754         LDKOnionMessage ret_conv;
13755         ret_conv.inner = untag_ptr(ret);
13756         ret_conv.is_owned = ptr_is_owned(ret);
13757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13758         return ret_conv;
13759 }
13760 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
13761         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
13762         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13763 }
13764 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
13765         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
13766         atomic_init(&calls->refcnt, 1);
13767         calls->instance_ptr = o;
13768
13769         LDKOnionMessageProvider ret = {
13770                 .this_arg = (void*) calls,
13771                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
13772                 .free = LDKOnionMessageProvider_JCalls_free,
13773         };
13774         return ret;
13775 }
13776 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
13777         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
13778         *res_ptr = LDKOnionMessageProvider_init(o);
13779         return tag_ptr(res_ptr, true);
13780 }
13781 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) {
13782         void* this_arg_ptr = untag_ptr(this_arg);
13783         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13784         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
13785         LDKPublicKey peer_node_id_ref;
13786         CHECK(peer_node_id->arr_len == 33);
13787         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
13788         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
13789         uint64_t ret_ref = 0;
13790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13792         return ret_ref;
13793 }
13794
13795 typedef struct LDKOnionMessageHandler_JCalls {
13796         atomic_size_t refcnt;
13797         uint32_t instance_ptr;
13798         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
13799 } LDKOnionMessageHandler_JCalls;
13800 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
13801         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13802         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13803                 FREE(j_calls);
13804         }
13805 }
13806 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
13807         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13808         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
13809         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
13810         LDKOnionMessage msg_var = *msg;
13811         uint64_t msg_ref = 0;
13812         msg_var = OnionMessage_clone(&msg_var);
13813         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13814         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13815         js_invoke_function_ubuuuu(j_calls->instance_ptr, 121, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
13816 }
13817 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
13818         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13819         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13820         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13821         LDKInit init_var = *init;
13822         uint64_t init_ref = 0;
13823         init_var = Init_clone(&init_var);
13824         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13825         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13826         jboolean inbound_conv = inbound;
13827         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 122, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
13828         void* ret_ptr = untag_ptr(ret);
13829         CHECK_ACCESS(ret_ptr);
13830         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13831         FREE(untag_ptr(ret));
13832         return ret_conv;
13833 }
13834 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13835         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13836         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13837         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13838         js_invoke_function_uuuuuu(j_calls->instance_ptr, 123, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13839 }
13840 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
13841         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13842         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 124, 0, 0, 0, 0, 0, 0);
13843         LDKNodeFeatures ret_conv;
13844         ret_conv.inner = untag_ptr(ret);
13845         ret_conv.is_owned = ptr_is_owned(ret);
13846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13847         return ret_conv;
13848 }
13849 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13850         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13851         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13852         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13853         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13854         LDKInitFeatures ret_conv;
13855         ret_conv.inner = untag_ptr(ret);
13856         ret_conv.is_owned = ptr_is_owned(ret);
13857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13858         return ret_conv;
13859 }
13860 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
13861         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
13862         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13863         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
13864 }
13865 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
13866         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
13867         atomic_init(&calls->refcnt, 1);
13868         calls->instance_ptr = o;
13869
13870         LDKOnionMessageHandler ret = {
13871                 .this_arg = (void*) calls,
13872                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
13873                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
13874                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
13875                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
13876                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
13877                 .free = LDKOnionMessageHandler_JCalls_free,
13878                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
13879         };
13880         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
13881         return ret;
13882 }
13883 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
13884         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
13885         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
13886         return tag_ptr(res_ptr, true);
13887 }
13888 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) {
13889         void* this_arg_ptr = untag_ptr(this_arg);
13890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13891         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13892         LDKPublicKey peer_node_id_ref;
13893         CHECK(peer_node_id->arr_len == 33);
13894         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
13895         LDKOnionMessage msg_conv;
13896         msg_conv.inner = untag_ptr(msg);
13897         msg_conv.is_owned = ptr_is_owned(msg);
13898         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13899         msg_conv.is_owned = false;
13900         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
13901 }
13902
13903 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) {
13904         void* this_arg_ptr = untag_ptr(this_arg);
13905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13906         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13907         LDKPublicKey their_node_id_ref;
13908         CHECK(their_node_id->arr_len == 33);
13909         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13910         LDKInit init_conv;
13911         init_conv.inner = untag_ptr(init);
13912         init_conv.is_owned = ptr_is_owned(init);
13913         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13914         init_conv.is_owned = false;
13915         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13916         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
13917         return tag_ptr(ret_conv, true);
13918 }
13919
13920 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
13921         void* this_arg_ptr = untag_ptr(this_arg);
13922         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13923         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13924         LDKPublicKey their_node_id_ref;
13925         CHECK(their_node_id->arr_len == 33);
13926         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13927         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13928 }
13929
13930 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
13931         void* this_arg_ptr = untag_ptr(this_arg);
13932         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13933         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13934         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13935         uint64_t ret_ref = 0;
13936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13938         return ret_ref;
13939 }
13940
13941 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13942         void* this_arg_ptr = untag_ptr(this_arg);
13943         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13944         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13945         LDKPublicKey their_node_id_ref;
13946         CHECK(their_node_id->arr_len == 33);
13947         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13948         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13949         uint64_t ret_ref = 0;
13950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13952         return ret_ref;
13953 }
13954
13955 typedef struct LDKCustomMessageReader_JCalls {
13956         atomic_size_t refcnt;
13957         uint32_t instance_ptr;
13958 } LDKCustomMessageReader_JCalls;
13959 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13960         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13961         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13962                 FREE(j_calls);
13963         }
13964 }
13965 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13966         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13967         int16_t message_type_conv = message_type;
13968         LDKu8slice buffer_var = buffer;
13969         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
13970         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
13971         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 126, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
13972         void* ret_ptr = untag_ptr(ret);
13973         CHECK_ACCESS(ret_ptr);
13974         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13975         FREE(untag_ptr(ret));
13976         return ret_conv;
13977 }
13978 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13979         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13980         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13981 }
13982 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
13983         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13984         atomic_init(&calls->refcnt, 1);
13985         calls->instance_ptr = o;
13986
13987         LDKCustomMessageReader ret = {
13988                 .this_arg = (void*) calls,
13989                 .read = read_LDKCustomMessageReader_jcall,
13990                 .free = LDKCustomMessageReader_JCalls_free,
13991         };
13992         return ret;
13993 }
13994 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
13995         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13996         *res_ptr = LDKCustomMessageReader_init(o);
13997         return tag_ptr(res_ptr, true);
13998 }
13999 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
14000         void* this_arg_ptr = untag_ptr(this_arg);
14001         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14002         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
14003         LDKu8slice buffer_ref;
14004         buffer_ref.datalen = buffer->arr_len;
14005         buffer_ref.data = buffer->elems;
14006         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14007         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
14008         FREE(buffer);
14009         return tag_ptr(ret_conv, true);
14010 }
14011
14012 typedef struct LDKCustomMessageHandler_JCalls {
14013         atomic_size_t refcnt;
14014         uint32_t instance_ptr;
14015         LDKCustomMessageReader_JCalls* CustomMessageReader;
14016 } LDKCustomMessageHandler_JCalls;
14017 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
14018         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14019         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14020                 FREE(j_calls);
14021         }
14022 }
14023 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
14024         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14025         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
14026         *msg_ret = msg;
14027         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
14028         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
14029         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 127, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
14030         void* ret_ptr = untag_ptr(ret);
14031         CHECK_ACCESS(ret_ptr);
14032         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14033         FREE(untag_ptr(ret));
14034         return ret_conv;
14035 }
14036 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
14037         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14038         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 128, 0, 0, 0, 0, 0, 0);
14039         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
14040         ret_constr.datalen = ret->arr_len;
14041         if (ret_constr.datalen > 0)
14042                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
14043         else
14044                 ret_constr.data = NULL;
14045         uint64_t* ret_vals = ret->elems;
14046         for (size_t z = 0; z < ret_constr.datalen; z++) {
14047                 uint64_t ret_conv_25 = ret_vals[z];
14048                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
14049                 CHECK_ACCESS(ret_conv_25_ptr);
14050                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
14051                 FREE(untag_ptr(ret_conv_25));
14052                 ret_constr.data[z] = ret_conv_25_conv;
14053         }
14054         FREE(ret);
14055         return ret_constr;
14056 }
14057 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
14058         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14059         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
14060         LDKNodeFeatures ret_conv;
14061         ret_conv.inner = untag_ptr(ret);
14062         ret_conv.is_owned = ptr_is_owned(ret);
14063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14064         return ret_conv;
14065 }
14066 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14067         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14068         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14069         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14070         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14071         LDKInitFeatures ret_conv;
14072         ret_conv.inner = untag_ptr(ret);
14073         ret_conv.is_owned = ptr_is_owned(ret);
14074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14075         return ret_conv;
14076 }
14077 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
14078         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
14079         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14080         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
14081 }
14082 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
14083         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
14084         atomic_init(&calls->refcnt, 1);
14085         calls->instance_ptr = o;
14086
14087         LDKCustomMessageHandler ret = {
14088                 .this_arg = (void*) calls,
14089                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
14090                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
14091                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
14092                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
14093                 .free = LDKCustomMessageHandler_JCalls_free,
14094                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
14095         };
14096         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
14097         return ret;
14098 }
14099 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
14100         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
14101         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
14102         return tag_ptr(res_ptr, true);
14103 }
14104 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) {
14105         void* this_arg_ptr = untag_ptr(this_arg);
14106         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14107         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14108         void* msg_ptr = untag_ptr(msg);
14109         CHECK_ACCESS(msg_ptr);
14110         LDKType msg_conv = *(LDKType*)(msg_ptr);
14111         if (msg_conv.free == LDKType_JCalls_free) {
14112                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14113                 LDKType_JCalls_cloned(&msg_conv);
14114         }
14115         LDKPublicKey sender_node_id_ref;
14116         CHECK(sender_node_id->arr_len == 33);
14117         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
14118         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14119         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
14120         return tag_ptr(ret_conv, true);
14121 }
14122
14123 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
14124         void* this_arg_ptr = untag_ptr(this_arg);
14125         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14126         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14127         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
14128         uint64_tArray ret_arr = NULL;
14129         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14130         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14131         for (size_t z = 0; z < ret_var.datalen; z++) {
14132                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
14133                 *ret_conv_25_conv = ret_var.data[z];
14134                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
14135         }
14136         
14137         FREE(ret_var.data);
14138         return ret_arr;
14139 }
14140
14141 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
14142         void* this_arg_ptr = untag_ptr(this_arg);
14143         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14144         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14145         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14146         uint64_t ret_ref = 0;
14147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14149         return ret_ref;
14150 }
14151
14152 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14153         void* this_arg_ptr = untag_ptr(this_arg);
14154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14155         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14156         LDKPublicKey their_node_id_ref;
14157         CHECK(their_node_id->arr_len == 33);
14158         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14159         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14160         uint64_t ret_ref = 0;
14161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14163         return ret_ref;
14164 }
14165
14166 typedef struct LDKOffersMessageHandler_JCalls {
14167         atomic_size_t refcnt;
14168         uint32_t instance_ptr;
14169 } LDKOffersMessageHandler_JCalls;
14170 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
14171         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14172         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14173                 FREE(j_calls);
14174         }
14175 }
14176 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
14177         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14178         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
14179         *message_copy = message;
14180         uint64_t message_ref = tag_ptr(message_copy, true);
14181         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 131, message_ref, 0, 0, 0, 0, 0);
14182         void* ret_ptr = untag_ptr(ret);
14183         CHECK_ACCESS(ret_ptr);
14184         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
14185         FREE(untag_ptr(ret));
14186         return ret_conv;
14187 }
14188 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
14189         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
14190         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14191 }
14192 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
14193         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
14194         atomic_init(&calls->refcnt, 1);
14195         calls->instance_ptr = o;
14196
14197         LDKOffersMessageHandler ret = {
14198                 .this_arg = (void*) calls,
14199                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
14200                 .free = LDKOffersMessageHandler_JCalls_free,
14201         };
14202         return ret;
14203 }
14204 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
14205         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
14206         *res_ptr = LDKOffersMessageHandler_init(o);
14207         return tag_ptr(res_ptr, true);
14208 }
14209 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
14210         void* this_arg_ptr = untag_ptr(this_arg);
14211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14212         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
14213         void* message_ptr = untag_ptr(message);
14214         CHECK_ACCESS(message_ptr);
14215         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
14216         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
14217         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14218         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
14219         uint64_t ret_ref = tag_ptr(ret_copy, true);
14220         return ret_ref;
14221 }
14222
14223 typedef struct LDKCustomOnionMessageHandler_JCalls {
14224         atomic_size_t refcnt;
14225         uint32_t instance_ptr;
14226 } LDKCustomOnionMessageHandler_JCalls;
14227 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
14228         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14229         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14230                 FREE(j_calls);
14231         }
14232 }
14233 LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
14234         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14235         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
14236         *msg_ret = msg;
14237         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 132, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
14238         void* ret_ptr = untag_ptr(ret);
14239         CHECK_ACCESS(ret_ptr);
14240         LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr);
14241         FREE(untag_ptr(ret));
14242         return ret_conv;
14243 }
14244 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
14245         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14246         int64_t message_type_conv = message_type;
14247         LDKu8slice buffer_var = buffer;
14248         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
14249         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
14250         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 133, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
14251         void* ret_ptr = untag_ptr(ret);
14252         CHECK_ACCESS(ret_ptr);
14253         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
14254         FREE(untag_ptr(ret));
14255         return ret_conv;
14256 }
14257 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
14258         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
14259         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14260 }
14261 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
14262         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
14263         atomic_init(&calls->refcnt, 1);
14264         calls->instance_ptr = o;
14265
14266         LDKCustomOnionMessageHandler ret = {
14267                 .this_arg = (void*) calls,
14268                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
14269                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
14270                 .free = LDKCustomOnionMessageHandler_JCalls_free,
14271         };
14272         return ret;
14273 }
14274 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
14275         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
14276         *res_ptr = LDKCustomOnionMessageHandler_init(o);
14277         return tag_ptr(res_ptr, true);
14278 }
14279 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
14280         void* this_arg_ptr = untag_ptr(this_arg);
14281         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14282         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14283         void* msg_ptr = untag_ptr(msg);
14284         CHECK_ACCESS(msg_ptr);
14285         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
14286         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
14287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14288                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
14289         }
14290         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
14291         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
14292         uint64_t ret_ref = tag_ptr(ret_copy, true);
14293         return ret_ref;
14294 }
14295
14296 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) {
14297         void* this_arg_ptr = untag_ptr(this_arg);
14298         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14299         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14300         LDKu8slice buffer_ref;
14301         buffer_ref.datalen = buffer->arr_len;
14302         buffer_ref.data = buffer->elems;
14303         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
14304         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
14305         FREE(buffer);
14306         return tag_ptr(ret_conv, true);
14307 }
14308
14309 typedef struct LDKSocketDescriptor_JCalls {
14310         atomic_size_t refcnt;
14311         uint32_t instance_ptr;
14312 } LDKSocketDescriptor_JCalls;
14313 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
14314         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14315         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14316                 FREE(j_calls);
14317         }
14318 }
14319 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
14320         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14321         LDKu8slice data_var = data;
14322         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
14323         memcpy(data_arr->elems, data_var.data, data_var.datalen);
14324         jboolean resume_read_conv = resume_read;
14325         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 134, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
14326 }
14327 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
14328         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14329         js_invoke_function_uuuuuu(j_calls->instance_ptr, 135, 0, 0, 0, 0, 0, 0);
14330 }
14331 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
14332         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14333         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14334         *other_arg_clone = SocketDescriptor_clone(other_arg);
14335         return js_invoke_function_buuuuu(j_calls->instance_ptr, 136, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
14336 }
14337 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
14338         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14339         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
14340 }
14341 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
14342         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
14343         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14344 }
14345 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
14346         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
14347         atomic_init(&calls->refcnt, 1);
14348         calls->instance_ptr = o;
14349
14350         LDKSocketDescriptor ret = {
14351                 .this_arg = (void*) calls,
14352                 .send_data = send_data_LDKSocketDescriptor_jcall,
14353                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
14354                 .eq = eq_LDKSocketDescriptor_jcall,
14355                 .hash = hash_LDKSocketDescriptor_jcall,
14356                 .cloned = LDKSocketDescriptor_JCalls_cloned,
14357                 .free = LDKSocketDescriptor_JCalls_free,
14358         };
14359         return ret;
14360 }
14361 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
14362         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14363         *res_ptr = LDKSocketDescriptor_init(o);
14364         return tag_ptr(res_ptr, true);
14365 }
14366 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
14367         void* this_arg_ptr = untag_ptr(this_arg);
14368         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14369         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14370         LDKu8slice data_ref;
14371         data_ref.datalen = data->arr_len;
14372         data_ref.data = data->elems;
14373         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
14374         FREE(data);
14375         return ret_conv;
14376 }
14377
14378 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
14379         void* this_arg_ptr = untag_ptr(this_arg);
14380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14381         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14382         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
14383 }
14384
14385 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
14386         void* this_arg_ptr = untag_ptr(this_arg);
14387         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14388         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14389         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
14390         return ret_conv;
14391 }
14392
14393 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
14394         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14395         switch(obj->tag) {
14396                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
14397                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
14398                 case LDKEffectiveCapacity_Total: return 2;
14399                 case LDKEffectiveCapacity_Infinite: return 3;
14400                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
14401                 case LDKEffectiveCapacity_Unknown: return 5;
14402                 default: abort();
14403         }
14404 }
14405 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
14406         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14407         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
14408                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
14409         return liquidity_msat_conv;
14410 }
14411 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
14412         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14413         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
14414                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
14415         return amount_msat_conv;
14416 }
14417 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
14418         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14419         assert(obj->tag == LDKEffectiveCapacity_Total);
14420                         int64_t capacity_msat_conv = obj->total.capacity_msat;
14421         return capacity_msat_conv;
14422 }
14423 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
14424         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14425         assert(obj->tag == LDKEffectiveCapacity_Total);
14426                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
14427         return htlc_maximum_msat_conv;
14428 }
14429 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
14430         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14431         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
14432                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
14433         return amount_msat_conv;
14434 }
14435 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
14436         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14437         switch(obj->tag) {
14438                 case LDKPayee_Blinded: return 0;
14439                 case LDKPayee_Clear: return 1;
14440                 default: abort();
14441         }
14442 }
14443 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
14444         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14445         assert(obj->tag == LDKPayee_Blinded);
14446                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
14447                         uint64_tArray route_hints_arr = NULL;
14448                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
14449                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
14450                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
14451                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
14452                                 *route_hints_conv_37_conv = route_hints_var.data[l];
14453                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
14454                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
14455                         }
14456                         
14457         return route_hints_arr;
14458 }
14459 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
14460         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14461         assert(obj->tag == LDKPayee_Blinded);
14462                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
14463                         uint64_t features_ref = 0;
14464                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
14465                         features_ref = tag_ptr(features_var.inner, false);
14466         return features_ref;
14467 }
14468 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
14469         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14470         assert(obj->tag == LDKPayee_Clear);
14471                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
14472                         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
14473         return node_id_arr;
14474 }
14475 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
14476         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14477         assert(obj->tag == LDKPayee_Clear);
14478                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
14479                         uint64_tArray route_hints_arr = NULL;
14480                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
14481                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
14482                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
14483                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
14484                                 uint64_t route_hints_conv_11_ref = 0;
14485                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
14486                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
14487                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
14488                         }
14489                         
14490         return route_hints_arr;
14491 }
14492 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
14493         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14494         assert(obj->tag == LDKPayee_Clear);
14495                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
14496                         uint64_t features_ref = 0;
14497                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
14498                         features_ref = tag_ptr(features_var.inner, false);
14499         return features_ref;
14500 }
14501 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
14502         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14503         assert(obj->tag == LDKPayee_Clear);
14504                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
14505         return final_cltv_expiry_delta_conv;
14506 }
14507 typedef struct LDKScore_JCalls {
14508         atomic_size_t refcnt;
14509         uint32_t instance_ptr;
14510         LDKScoreLookUp_JCalls* ScoreLookUp;
14511         LDKScoreUpdate_JCalls* ScoreUpdate;
14512 } LDKScore_JCalls;
14513 static void LDKScore_JCalls_free(void* this_arg) {
14514         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
14515         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14516                 FREE(j_calls);
14517         }
14518 }
14519 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
14520         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
14521         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 138, 0, 0, 0, 0, 0, 0);
14522         LDKCVec_u8Z ret_ref;
14523         ret_ref.datalen = ret->arr_len;
14524         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
14525         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
14526         return ret_ref;
14527 }
14528 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
14529         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
14530         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14531         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
14532         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
14533 }
14534 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
14535         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
14536         atomic_init(&calls->refcnt, 1);
14537         calls->instance_ptr = o;
14538
14539         LDKScore ret = {
14540                 .this_arg = (void*) calls,
14541                 .write = write_LDKScore_jcall,
14542                 .free = LDKScore_JCalls_free,
14543                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
14544                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
14545         };
14546         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
14547         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
14548         return ret;
14549 }
14550 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
14551         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
14552         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
14553         return tag_ptr(res_ptr, true);
14554 }
14555 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
14556         void* this_arg_ptr = untag_ptr(this_arg);
14557         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14558         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
14559         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
14560         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
14561         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
14562         CVec_u8Z_free(ret_var);
14563         return ret_arr;
14564 }
14565
14566 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
14567         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
14568         switch(obj->tag) {
14569                 case LDKDestination_Node: return 0;
14570                 case LDKDestination_BlindedPath: return 1;
14571                 default: abort();
14572         }
14573 }
14574 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
14575         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
14576         assert(obj->tag == LDKDestination_Node);
14577                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
14578                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
14579         return node_arr;
14580 }
14581 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
14582         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
14583         assert(obj->tag == LDKDestination_BlindedPath);
14584                         LDKBlindedPath blinded_path_var = obj->blinded_path;
14585                         uint64_t blinded_path_ref = 0;
14586                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
14587                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
14588         return blinded_path_ref;
14589 }
14590 typedef struct LDKMessageRouter_JCalls {
14591         atomic_size_t refcnt;
14592         uint32_t instance_ptr;
14593 } LDKMessageRouter_JCalls;
14594 static void LDKMessageRouter_JCalls_free(void* this_arg) {
14595         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
14596         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14597                 FREE(j_calls);
14598         }
14599 }
14600 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
14601         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
14602         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
14603         memcpy(sender_arr->elems, sender.compressed_form, 33);
14604         LDKCVec_PublicKeyZ peers_var = peers;
14605         ptrArray peers_arr = NULL;
14606         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
14607         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
14608         for (size_t m = 0; m < peers_var.datalen; m++) {
14609                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
14610                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
14611                 peers_arr_ptr[m] = peers_conv_12_arr;
14612         }
14613         
14614         FREE(peers_var.data);
14615         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
14616         *destination_copy = destination;
14617         uint64_t destination_ref = tag_ptr(destination_copy, true);
14618         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 139, (uint32_t)sender_arr, (uint32_t)peers_arr, destination_ref, 0, 0, 0);
14619         void* ret_ptr = untag_ptr(ret);
14620         CHECK_ACCESS(ret_ptr);
14621         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
14622         FREE(untag_ptr(ret));
14623         return ret_conv;
14624 }
14625 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
14626         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
14627         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14628 }
14629 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
14630         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
14631         atomic_init(&calls->refcnt, 1);
14632         calls->instance_ptr = o;
14633
14634         LDKMessageRouter ret = {
14635                 .this_arg = (void*) calls,
14636                 .find_path = find_path_LDKMessageRouter_jcall,
14637                 .free = LDKMessageRouter_JCalls_free,
14638         };
14639         return ret;
14640 }
14641 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
14642         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
14643         *res_ptr = LDKMessageRouter_init(o);
14644         return tag_ptr(res_ptr, true);
14645 }
14646 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) {
14647         void* this_arg_ptr = untag_ptr(this_arg);
14648         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14649         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
14650         LDKPublicKey sender_ref;
14651         CHECK(sender->arr_len == 33);
14652         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
14653         LDKCVec_PublicKeyZ peers_constr;
14654         peers_constr.datalen = peers->arr_len;
14655         if (peers_constr.datalen > 0)
14656                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
14657         else
14658                 peers_constr.data = NULL;
14659         int8_tArray* peers_vals = (void*) peers->elems;
14660         for (size_t m = 0; m < peers_constr.datalen; m++) {
14661                 int8_tArray peers_conv_12 = peers_vals[m];
14662                 LDKPublicKey peers_conv_12_ref;
14663                 CHECK(peers_conv_12->arr_len == 33);
14664                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
14665                 peers_constr.data[m] = peers_conv_12_ref;
14666         }
14667         FREE(peers);
14668         void* destination_ptr = untag_ptr(destination);
14669         CHECK_ACCESS(destination_ptr);
14670         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
14671         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
14672         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
14673         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
14674         return tag_ptr(ret_conv, true);
14675 }
14676
14677 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
14678         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
14679         switch(obj->tag) {
14680                 case LDKOnionMessageContents_Offers: return 0;
14681                 case LDKOnionMessageContents_Custom: return 1;
14682                 default: abort();
14683         }
14684 }
14685 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Offers_get_offers"))) TS_LDKOnionMessageContents_Offers_get_offers(uint64_t ptr) {
14686         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
14687         assert(obj->tag == LDKOnionMessageContents_Offers);
14688                         uint64_t offers_ref = tag_ptr(&obj->offers, false);
14689         return offers_ref;
14690 }
14691 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
14692         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
14693         assert(obj->tag == LDKOnionMessageContents_Custom);
14694                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
14695                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
14696         return tag_ptr(custom_ret, true);
14697 }
14698 typedef struct LDKCoinSelectionSource_JCalls {
14699         atomic_size_t refcnt;
14700         uint32_t instance_ptr;
14701 } LDKCoinSelectionSource_JCalls;
14702 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
14703         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14704         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14705                 FREE(j_calls);
14706         }
14707 }
14708 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) {
14709         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14710         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
14711         memcpy(claim_id_arr->elems, claim_id.data, 32);
14712         LDKCVec_InputZ must_spend_var = must_spend;
14713         uint64_tArray must_spend_arr = NULL;
14714         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
14715         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
14716         for (size_t h = 0; h < must_spend_var.datalen; h++) {
14717                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
14718                 uint64_t must_spend_conv_7_ref = 0;
14719                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
14720                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
14721                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
14722         }
14723         
14724         FREE(must_spend_var.data);
14725         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
14726         uint64_tArray must_pay_to_arr = NULL;
14727         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
14728         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
14729         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
14730                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14731                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
14732                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
14733         }
14734         
14735         FREE(must_pay_to_var.data);
14736         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
14737         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 140, (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);
14738         void* ret_ptr = untag_ptr(ret);
14739         CHECK_ACCESS(ret_ptr);
14740         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
14741         FREE(untag_ptr(ret));
14742         return ret_conv;
14743 }
14744 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
14745         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14746         LDKTransaction tx_var = tx;
14747         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
14748         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
14749         Transaction_free(tx_var);
14750         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 141, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
14751         void* ret_ptr = untag_ptr(ret);
14752         CHECK_ACCESS(ret_ptr);
14753         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
14754         FREE(untag_ptr(ret));
14755         return ret_conv;
14756 }
14757 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
14758         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
14759         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14760 }
14761 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
14762         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
14763         atomic_init(&calls->refcnt, 1);
14764         calls->instance_ptr = o;
14765
14766         LDKCoinSelectionSource ret = {
14767                 .this_arg = (void*) calls,
14768                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
14769                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
14770                 .free = LDKCoinSelectionSource_JCalls_free,
14771         };
14772         return ret;
14773 }
14774 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
14775         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
14776         *res_ptr = LDKCoinSelectionSource_init(o);
14777         return tag_ptr(res_ptr, true);
14778 }
14779 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) {
14780         void* this_arg_ptr = untag_ptr(this_arg);
14781         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14782         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
14783         LDKThirtyTwoBytes claim_id_ref;
14784         CHECK(claim_id->arr_len == 32);
14785         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
14786         LDKCVec_InputZ must_spend_constr;
14787         must_spend_constr.datalen = must_spend->arr_len;
14788         if (must_spend_constr.datalen > 0)
14789                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
14790         else
14791                 must_spend_constr.data = NULL;
14792         uint64_t* must_spend_vals = must_spend->elems;
14793         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
14794                 uint64_t must_spend_conv_7 = must_spend_vals[h];
14795                 LDKInput must_spend_conv_7_conv;
14796                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
14797                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
14798                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
14799                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
14800                 must_spend_constr.data[h] = must_spend_conv_7_conv;
14801         }
14802         FREE(must_spend);
14803         LDKCVec_TxOutZ must_pay_to_constr;
14804         must_pay_to_constr.datalen = must_pay_to->arr_len;
14805         if (must_pay_to_constr.datalen > 0)
14806                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14807         else
14808                 must_pay_to_constr.data = NULL;
14809         uint64_t* must_pay_to_vals = must_pay_to->elems;
14810         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
14811                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
14812                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
14813                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
14814                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
14815                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
14816                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
14817         }
14818         FREE(must_pay_to);
14819         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
14820         *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);
14821         return tag_ptr(ret_conv, true);
14822 }
14823
14824 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_tx"))) TS_CoinSelectionSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
14825         void* this_arg_ptr = untag_ptr(this_arg);
14826         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14827         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
14828         LDKTransaction tx_ref;
14829         tx_ref.datalen = tx->arr_len;
14830         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
14831         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
14832         tx_ref.data_is_owned = true;
14833         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14834         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
14835         return tag_ptr(ret_conv, true);
14836 }
14837
14838 typedef struct LDKWalletSource_JCalls {
14839         atomic_size_t refcnt;
14840         uint32_t instance_ptr;
14841 } LDKWalletSource_JCalls;
14842 static void LDKWalletSource_JCalls_free(void* this_arg) {
14843         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14844         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14845                 FREE(j_calls);
14846         }
14847 }
14848 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
14849         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14850         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 142, 0, 0, 0, 0, 0, 0);
14851         void* ret_ptr = untag_ptr(ret);
14852         CHECK_ACCESS(ret_ptr);
14853         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
14854         FREE(untag_ptr(ret));
14855         return ret_conv;
14856 }
14857 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
14858         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14859         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, 0, 0, 0, 0, 0, 0);
14860         void* ret_ptr = untag_ptr(ret);
14861         CHECK_ACCESS(ret_ptr);
14862         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
14863         FREE(untag_ptr(ret));
14864         return ret_conv;
14865 }
14866 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
14867         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14868         LDKTransaction tx_var = tx;
14869         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
14870         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
14871         Transaction_free(tx_var);
14872         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 144, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
14873         void* ret_ptr = untag_ptr(ret);
14874         CHECK_ACCESS(ret_ptr);
14875         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
14876         FREE(untag_ptr(ret));
14877         return ret_conv;
14878 }
14879 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
14880         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
14881         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14882 }
14883 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
14884         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
14885         atomic_init(&calls->refcnt, 1);
14886         calls->instance_ptr = o;
14887
14888         LDKWalletSource ret = {
14889                 .this_arg = (void*) calls,
14890                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
14891                 .get_change_script = get_change_script_LDKWalletSource_jcall,
14892                 .sign_tx = sign_tx_LDKWalletSource_jcall,
14893                 .free = LDKWalletSource_JCalls_free,
14894         };
14895         return ret;
14896 }
14897 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
14898         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
14899         *res_ptr = LDKWalletSource_init(o);
14900         return tag_ptr(res_ptr, true);
14901 }
14902 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
14903         void* this_arg_ptr = untag_ptr(this_arg);
14904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14905         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14906         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
14907         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
14908         return tag_ptr(ret_conv, true);
14909 }
14910
14911 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
14912         void* this_arg_ptr = untag_ptr(this_arg);
14913         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14914         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14915         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
14916         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
14917         return tag_ptr(ret_conv, true);
14918 }
14919
14920 uint64_t  __attribute__((export_name("TS_WalletSource_sign_tx"))) TS_WalletSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
14921         void* this_arg_ptr = untag_ptr(this_arg);
14922         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14923         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14924         LDKTransaction tx_ref;
14925         tx_ref.datalen = tx->arr_len;
14926         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
14927         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
14928         tx_ref.data_is_owned = true;
14929         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14930         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
14931         return tag_ptr(ret_conv, true);
14932 }
14933
14934 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
14935         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14936         switch(obj->tag) {
14937                 case LDKGossipSync_P2P: return 0;
14938                 case LDKGossipSync_Rapid: return 1;
14939                 case LDKGossipSync_None: return 2;
14940                 default: abort();
14941         }
14942 }
14943 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
14944         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14945         assert(obj->tag == LDKGossipSync_P2P);
14946                         LDKP2PGossipSync p2p_var = obj->p2p;
14947                         uint64_t p2p_ref = 0;
14948                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
14949                         p2p_ref = tag_ptr(p2p_var.inner, false);
14950         return p2p_ref;
14951 }
14952 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
14953         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14954         assert(obj->tag == LDKGossipSync_Rapid);
14955                         LDKRapidGossipSync rapid_var = obj->rapid;
14956                         uint64_t rapid_ref = 0;
14957                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
14958                         rapid_ref = tag_ptr(rapid_var.inner, false);
14959         return rapid_ref;
14960 }
14961 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
14962         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14963         switch(obj->tag) {
14964                 case LDKFallback_SegWitProgram: return 0;
14965                 case LDKFallback_PubKeyHash: return 1;
14966                 case LDKFallback_ScriptHash: return 2;
14967                 default: abort();
14968         }
14969 }
14970 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
14971         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14972         assert(obj->tag == LDKFallback_SegWitProgram);
14973                         uint8_t version_val = obj->seg_wit_program.version._0;
14974         return version_val;
14975 }
14976 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
14977         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14978         assert(obj->tag == LDKFallback_SegWitProgram);
14979                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
14980                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
14981                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
14982         return program_arr;
14983 }
14984 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
14985         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14986         assert(obj->tag == LDKFallback_PubKeyHash);
14987                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
14988                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
14989         return pub_key_hash_arr;
14990 }
14991 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
14992         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14993         assert(obj->tag == LDKFallback_ScriptHash);
14994                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
14995                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
14996         return script_hash_arr;
14997 }
14998 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
14999         LDKStr ret_str = _ldk_get_compiled_version();
15000         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15001         Str_free(ret_str);
15002         return ret_conv;
15003 }
15004
15005 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
15006         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
15007         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15008         Str_free(ret_str);
15009         return ret_conv;
15010 }
15011
15012 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
15013         LDKU128 val_ref;
15014         CHECK(val->arr_len == 16);
15015         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
15016         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
15017         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
15018         return ret_arr;
15019 }
15020
15021 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
15022         LDKSixteenBytes le_bytes_ref;
15023         CHECK(le_bytes->arr_len == 16);
15024         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
15025         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
15026         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
15027         return ret_arr;
15028 }
15029
15030 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
15031         LDKThirtyTwoBytes big_endian_bytes_ref;
15032         CHECK(big_endian_bytes->arr_len == 32);
15033         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
15034         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
15035         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
15036         return tag_ptr(ret_ref, true);
15037 }
15038
15039 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
15040         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15041         *ret_copy = Bech32Error_clone(arg);
15042         uint64_t ret_ref = tag_ptr(ret_copy, true);
15043         return ret_ref;
15044 }
15045 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
15046         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
15047         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
15048         return ret_conv;
15049 }
15050
15051 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
15052         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
15053         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15054         *ret_copy = Bech32Error_clone(orig_conv);
15055         uint64_t ret_ref = tag_ptr(ret_copy, true);
15056         return ret_ref;
15057 }
15058
15059 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
15060         if (!ptr_is_owned(o)) return;
15061         void* o_ptr = untag_ptr(o);
15062         CHECK_ACCESS(o_ptr);
15063         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
15064         FREE(untag_ptr(o));
15065         Bech32Error_free(o_conv);
15066 }
15067
15068 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
15069         LDKTransaction _res_ref;
15070         _res_ref.datalen = _res->arr_len;
15071         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
15072         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15073         _res_ref.data_is_owned = true;
15074         Transaction_free(_res_ref);
15075 }
15076
15077 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
15078         LDKWitness _res_ref;
15079         _res_ref.datalen = _res->arr_len;
15080         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
15081         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15082         _res_ref.data_is_owned = true;
15083         Witness_free(_res_ref);
15084 }
15085
15086 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
15087         if (!ptr_is_owned(_res)) return;
15088         void* _res_ptr = untag_ptr(_res);
15089         CHECK_ACCESS(_res_ptr);
15090         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
15091         FREE(untag_ptr(_res));
15092         TxIn_free(_res_conv);
15093 }
15094
15095 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) {
15096         LDKWitness witness_ref;
15097         witness_ref.datalen = witness->arr_len;
15098         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
15099         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
15100         witness_ref.data_is_owned = true;
15101         LDKCVec_u8Z script_sig_ref;
15102         script_sig_ref.datalen = script_sig->arr_len;
15103         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
15104         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
15105         LDKThirtyTwoBytes previous_txid_ref;
15106         CHECK(previous_txid->arr_len == 32);
15107         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
15108         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
15109         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
15110         return tag_ptr(ret_ref, true);
15111 }
15112
15113 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
15114         LDKCVec_u8Z script_pubkey_ref;
15115         script_pubkey_ref.datalen = script_pubkey->arr_len;
15116         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
15117         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
15118         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15119         *ret_ref = TxOut_new(script_pubkey_ref, value);
15120         return tag_ptr(ret_ref, true);
15121 }
15122
15123 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
15124         if (!ptr_is_owned(_res)) return;
15125         void* _res_ptr = untag_ptr(_res);
15126         CHECK_ACCESS(_res_ptr);
15127         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
15128         FREE(untag_ptr(_res));
15129         TxOut_free(_res_conv);
15130 }
15131
15132 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
15133         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15134         *ret_ref = TxOut_clone(arg);
15135         return tag_ptr(ret_ref, true);
15136 }
15137 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
15138         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
15139         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
15140         return ret_conv;
15141 }
15142
15143 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
15144         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
15145         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15146         *ret_ref = TxOut_clone(orig_conv);
15147         return tag_ptr(ret_ref, true);
15148 }
15149
15150 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
15151         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
15152         Str_free(dummy);
15153 }
15154
15155 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
15156         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15157         *ret_copy = COption_u64Z_some(o);
15158         uint64_t ret_ref = tag_ptr(ret_copy, true);
15159         return ret_ref;
15160 }
15161
15162 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
15163         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15164         *ret_copy = COption_u64Z_none();
15165         uint64_t ret_ref = tag_ptr(ret_copy, true);
15166         return ret_ref;
15167 }
15168
15169 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
15170         if (!ptr_is_owned(_res)) return;
15171         void* _res_ptr = untag_ptr(_res);
15172         CHECK_ACCESS(_res_ptr);
15173         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15174         FREE(untag_ptr(_res));
15175         COption_u64Z_free(_res_conv);
15176 }
15177
15178 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15179         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15180         *ret_copy = COption_u64Z_clone(arg);
15181         uint64_t ret_ref = tag_ptr(ret_copy, true);
15182         return ret_ref;
15183 }
15184 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
15185         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
15186         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15187         return ret_conv;
15188 }
15189
15190 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
15191         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
15192         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15193         *ret_copy = COption_u64Z_clone(orig_conv);
15194         uint64_t ret_ref = tag_ptr(ret_copy, true);
15195         return ret_ref;
15196 }
15197
15198 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
15199         LDKCVec_BlindedPathZ _res_constr;
15200         _res_constr.datalen = _res->arr_len;
15201         if (_res_constr.datalen > 0)
15202                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
15203         else
15204                 _res_constr.data = NULL;
15205         uint64_t* _res_vals = _res->elems;
15206         for (size_t n = 0; n < _res_constr.datalen; n++) {
15207                 uint64_t _res_conv_13 = _res_vals[n];
15208                 LDKBlindedPath _res_conv_13_conv;
15209                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
15210                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
15211                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
15212                 _res_constr.data[n] = _res_conv_13_conv;
15213         }
15214         FREE(_res);
15215         CVec_BlindedPathZ_free(_res_constr);
15216 }
15217
15218 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
15219         LDKRefund o_conv;
15220         o_conv.inner = untag_ptr(o);
15221         o_conv.is_owned = ptr_is_owned(o);
15222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15223         o_conv = Refund_clone(&o_conv);
15224         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15225         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
15226         return tag_ptr(ret_conv, true);
15227 }
15228
15229 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
15230         LDKBolt12ParseError e_conv;
15231         e_conv.inner = untag_ptr(e);
15232         e_conv.is_owned = ptr_is_owned(e);
15233         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15234         e_conv = Bolt12ParseError_clone(&e_conv);
15235         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15236         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
15237         return tag_ptr(ret_conv, true);
15238 }
15239
15240 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
15241         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
15242         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
15243         return ret_conv;
15244 }
15245
15246 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
15247         if (!ptr_is_owned(_res)) return;
15248         void* _res_ptr = untag_ptr(_res);
15249         CHECK_ACCESS(_res_ptr);
15250         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
15251         FREE(untag_ptr(_res));
15252         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
15253 }
15254
15255 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
15256         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15257         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
15258         return tag_ptr(ret_conv, true);
15259 }
15260 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
15261         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
15262         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
15263         return ret_conv;
15264 }
15265
15266 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
15267         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
15268         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15269         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
15270         return tag_ptr(ret_conv, true);
15271 }
15272
15273 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
15274         void* o_ptr = untag_ptr(o);
15275         CHECK_ACCESS(o_ptr);
15276         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
15277         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
15278         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15279         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
15280         return tag_ptr(ret_conv, true);
15281 }
15282
15283 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
15284         void* e_ptr = untag_ptr(e);
15285         CHECK_ACCESS(e_ptr);
15286         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15287         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15288         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15289         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
15290         return tag_ptr(ret_conv, true);
15291 }
15292
15293 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
15294         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
15295         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
15296         return ret_conv;
15297 }
15298
15299 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
15300         if (!ptr_is_owned(_res)) return;
15301         void* _res_ptr = untag_ptr(_res);
15302         CHECK_ACCESS(_res_ptr);
15303         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
15304         FREE(untag_ptr(_res));
15305         CResult_RetryDecodeErrorZ_free(_res_conv);
15306 }
15307
15308 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
15309         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15310         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
15311         return tag_ptr(ret_conv, true);
15312 }
15313 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
15314         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
15315         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
15316         return ret_conv;
15317 }
15318
15319 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
15320         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
15321         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15322         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
15323         return tag_ptr(ret_conv, true);
15324 }
15325
15326 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15327         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15328         *ret_conv = CResult_NoneAPIErrorZ_ok();
15329         return tag_ptr(ret_conv, true);
15330 }
15331
15332 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
15333         void* e_ptr = untag_ptr(e);
15334         CHECK_ACCESS(e_ptr);
15335         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15336         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15337         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15338         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15339         return tag_ptr(ret_conv, true);
15340 }
15341
15342 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
15343         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15344         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15345         return ret_conv;
15346 }
15347
15348 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
15349         if (!ptr_is_owned(_res)) return;
15350         void* _res_ptr = untag_ptr(_res);
15351         CHECK_ACCESS(_res_ptr);
15352         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15353         FREE(untag_ptr(_res));
15354         CResult_NoneAPIErrorZ_free(_res_conv);
15355 }
15356
15357 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15358         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15359         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15360         return tag_ptr(ret_conv, true);
15361 }
15362 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
15363         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15364         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15365         return ret_conv;
15366 }
15367
15368 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
15369         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15370         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15371         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15372         return tag_ptr(ret_conv, true);
15373 }
15374
15375 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
15376         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15377         _res_constr.datalen = _res->arr_len;
15378         if (_res_constr.datalen > 0)
15379                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15380         else
15381                 _res_constr.data = NULL;
15382         uint64_t* _res_vals = _res->elems;
15383         for (size_t w = 0; w < _res_constr.datalen; w++) {
15384                 uint64_t _res_conv_22 = _res_vals[w];
15385                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15386                 CHECK_ACCESS(_res_conv_22_ptr);
15387                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15388                 FREE(untag_ptr(_res_conv_22));
15389                 _res_constr.data[w] = _res_conv_22_conv;
15390         }
15391         FREE(_res);
15392         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15393 }
15394
15395 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
15396         LDKCVec_APIErrorZ _res_constr;
15397         _res_constr.datalen = _res->arr_len;
15398         if (_res_constr.datalen > 0)
15399                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15400         else
15401                 _res_constr.data = NULL;
15402         uint64_t* _res_vals = _res->elems;
15403         for (size_t k = 0; k < _res_constr.datalen; k++) {
15404                 uint64_t _res_conv_10 = _res_vals[k];
15405                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15406                 CHECK_ACCESS(_res_conv_10_ptr);
15407                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15408                 FREE(untag_ptr(_res_conv_10));
15409                 _res_constr.data[k] = _res_conv_10_conv;
15410         }
15411         FREE(_res);
15412         CVec_APIErrorZ_free(_res_constr);
15413 }
15414
15415 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
15416         LDKThirtyTwoBytes o_ref;
15417         CHECK(o->arr_len == 32);
15418         memcpy(o_ref.data, o->elems, 32); FREE(o);
15419         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15420         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
15421         uint64_t ret_ref = tag_ptr(ret_copy, true);
15422         return ret_ref;
15423 }
15424
15425 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
15426         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15427         *ret_copy = COption_ThirtyTwoBytesZ_none();
15428         uint64_t ret_ref = tag_ptr(ret_copy, true);
15429         return ret_ref;
15430 }
15431
15432 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
15433         if (!ptr_is_owned(_res)) return;
15434         void* _res_ptr = untag_ptr(_res);
15435         CHECK_ACCESS(_res_ptr);
15436         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
15437         FREE(untag_ptr(_res));
15438         COption_ThirtyTwoBytesZ_free(_res_conv);
15439 }
15440
15441 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
15442         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15443         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
15444         uint64_t ret_ref = tag_ptr(ret_copy, true);
15445         return ret_ref;
15446 }
15447 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
15448         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
15449         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
15450         return ret_conv;
15451 }
15452
15453 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
15454         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
15455         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15456         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
15457         uint64_t ret_ref = tag_ptr(ret_copy, true);
15458         return ret_ref;
15459 }
15460
15461 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15462         LDKCVec_u8Z _res_ref;
15463         _res_ref.datalen = _res->arr_len;
15464         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15465         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15466         CVec_u8Z_free(_res_ref);
15467 }
15468
15469 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
15470         LDKCVec_u8Z o_ref;
15471         o_ref.datalen = o->arr_len;
15472         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
15473         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15474         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15475         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
15476         uint64_t ret_ref = tag_ptr(ret_copy, true);
15477         return ret_ref;
15478 }
15479
15480 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
15481         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15482         *ret_copy = COption_CVec_u8ZZ_none();
15483         uint64_t ret_ref = tag_ptr(ret_copy, true);
15484         return ret_ref;
15485 }
15486
15487 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
15488         if (!ptr_is_owned(_res)) return;
15489         void* _res_ptr = untag_ptr(_res);
15490         CHECK_ACCESS(_res_ptr);
15491         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
15492         FREE(untag_ptr(_res));
15493         COption_CVec_u8ZZ_free(_res_conv);
15494 }
15495
15496 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
15497         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15498         *ret_copy = COption_CVec_u8ZZ_clone(arg);
15499         uint64_t ret_ref = tag_ptr(ret_copy, true);
15500         return ret_ref;
15501 }
15502 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
15503         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
15504         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
15505         return ret_conv;
15506 }
15507
15508 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
15509         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
15510         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15511         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
15512         uint64_t ret_ref = tag_ptr(ret_copy, true);
15513         return ret_ref;
15514 }
15515
15516 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
15517         LDKRecipientOnionFields o_conv;
15518         o_conv.inner = untag_ptr(o);
15519         o_conv.is_owned = ptr_is_owned(o);
15520         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15521         o_conv = RecipientOnionFields_clone(&o_conv);
15522         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15523         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
15524         return tag_ptr(ret_conv, true);
15525 }
15526
15527 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
15528         void* e_ptr = untag_ptr(e);
15529         CHECK_ACCESS(e_ptr);
15530         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15531         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15532         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15533         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
15534         return tag_ptr(ret_conv, true);
15535 }
15536
15537 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
15538         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
15539         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
15540         return ret_conv;
15541 }
15542
15543 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
15544         if (!ptr_is_owned(_res)) return;
15545         void* _res_ptr = untag_ptr(_res);
15546         CHECK_ACCESS(_res_ptr);
15547         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
15548         FREE(untag_ptr(_res));
15549         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
15550 }
15551
15552 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
15553         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15554         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
15555         return tag_ptr(ret_conv, true);
15556 }
15557 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
15558         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
15559         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
15560         return ret_conv;
15561 }
15562
15563 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
15564         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
15565         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15566         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
15567         return tag_ptr(ret_conv, true);
15568 }
15569
15570 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
15571         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15572         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
15573         return tag_ptr(ret_conv, true);
15574 }
15575 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
15576         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
15577         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
15578         return ret_conv;
15579 }
15580
15581 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
15582         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
15583         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15584         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
15585         return tag_ptr(ret_conv, true);
15586 }
15587
15588 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
15589         LDKCVec_u8Z b_ref;
15590         b_ref.datalen = b->arr_len;
15591         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
15592         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
15593         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15594         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
15595         return tag_ptr(ret_conv, true);
15596 }
15597
15598 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
15599         if (!ptr_is_owned(_res)) return;
15600         void* _res_ptr = untag_ptr(_res);
15601         CHECK_ACCESS(_res_ptr);
15602         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
15603         FREE(untag_ptr(_res));
15604         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
15605 }
15606
15607 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
15608         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
15609         _res_constr.datalen = _res->arr_len;
15610         if (_res_constr.datalen > 0)
15611                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
15612         else
15613                 _res_constr.data = NULL;
15614         uint64_t* _res_vals = _res->elems;
15615         for (size_t x = 0; x < _res_constr.datalen; x++) {
15616                 uint64_t _res_conv_23 = _res_vals[x];
15617                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
15618                 CHECK_ACCESS(_res_conv_23_ptr);
15619                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
15620                 FREE(untag_ptr(_res_conv_23));
15621                 _res_constr.data[x] = _res_conv_23_conv;
15622         }
15623         FREE(_res);
15624         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
15625 }
15626
15627 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
15628         LDKRecipientOnionFields o_conv;
15629         o_conv.inner = untag_ptr(o);
15630         o_conv.is_owned = ptr_is_owned(o);
15631         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15632         o_conv = RecipientOnionFields_clone(&o_conv);
15633         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15634         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
15635         return tag_ptr(ret_conv, true);
15636 }
15637
15638 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
15639         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15640         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
15641         return tag_ptr(ret_conv, true);
15642 }
15643
15644 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
15645         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
15646         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
15647         return ret_conv;
15648 }
15649
15650 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
15651         if (!ptr_is_owned(_res)) return;
15652         void* _res_ptr = untag_ptr(_res);
15653         CHECK_ACCESS(_res_ptr);
15654         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
15655         FREE(untag_ptr(_res));
15656         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
15657 }
15658
15659 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
15660         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15661         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
15662         return tag_ptr(ret_conv, true);
15663 }
15664 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
15665         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
15666         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
15667         return ret_conv;
15668 }
15669
15670 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
15671         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
15672         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15673         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
15674         return tag_ptr(ret_conv, true);
15675 }
15676
15677 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
15678         LDKCVec_ThirtyTwoBytesZ _res_constr;
15679         _res_constr.datalen = _res->arr_len;
15680         if (_res_constr.datalen > 0)
15681                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15682         else
15683                 _res_constr.data = NULL;
15684         int8_tArray* _res_vals = (void*) _res->elems;
15685         for (size_t m = 0; m < _res_constr.datalen; m++) {
15686                 int8_tArray _res_conv_12 = _res_vals[m];
15687                 LDKThirtyTwoBytes _res_conv_12_ref;
15688                 CHECK(_res_conv_12->arr_len == 32);
15689                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15690                 _res_constr.data[m] = _res_conv_12_ref;
15691         }
15692         FREE(_res);
15693         CVec_ThirtyTwoBytesZ_free(_res_constr);
15694 }
15695
15696 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
15697         LDKCVec_ThirtyTwoBytesZ o_constr;
15698         o_constr.datalen = o->arr_len;
15699         if (o_constr.datalen > 0)
15700                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15701         else
15702                 o_constr.data = NULL;
15703         int8_tArray* o_vals = (void*) o->elems;
15704         for (size_t m = 0; m < o_constr.datalen; m++) {
15705                 int8_tArray o_conv_12 = o_vals[m];
15706                 LDKThirtyTwoBytes o_conv_12_ref;
15707                 CHECK(o_conv_12->arr_len == 32);
15708                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
15709                 o_constr.data[m] = o_conv_12_ref;
15710         }
15711         FREE(o);
15712         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15713         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
15714         uint64_t ret_ref = tag_ptr(ret_copy, true);
15715         return ret_ref;
15716 }
15717
15718 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
15719         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15720         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
15721         uint64_t ret_ref = tag_ptr(ret_copy, true);
15722         return ret_ref;
15723 }
15724
15725 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
15726         if (!ptr_is_owned(_res)) return;
15727         void* _res_ptr = untag_ptr(_res);
15728         CHECK_ACCESS(_res_ptr);
15729         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
15730         FREE(untag_ptr(_res));
15731         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
15732 }
15733
15734 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
15735         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15736         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
15737         uint64_t ret_ref = tag_ptr(ret_copy, true);
15738         return ret_ref;
15739 }
15740 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
15741         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
15742         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
15743         return ret_conv;
15744 }
15745
15746 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
15747         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
15748         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15749         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
15750         uint64_t ret_ref = tag_ptr(ret_copy, true);
15751         return ret_ref;
15752 }
15753
15754 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
15755         LDKThirtyTwoBytes o_ref;
15756         CHECK(o->arr_len == 32);
15757         memcpy(o_ref.data, o->elems, 32); FREE(o);
15758         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
15759         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
15760         return tag_ptr(ret_conv, true);
15761 }
15762
15763 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
15764         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
15765         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
15766         return tag_ptr(ret_conv, true);
15767 }
15768
15769 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
15770         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
15771         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
15772         return ret_conv;
15773 }
15774
15775 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
15776         if (!ptr_is_owned(_res)) return;
15777         void* _res_ptr = untag_ptr(_res);
15778         CHECK_ACCESS(_res_ptr);
15779         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
15780         FREE(untag_ptr(_res));
15781         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
15782 }
15783
15784 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
15785         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
15786         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
15787         return tag_ptr(ret_conv, true);
15788 }
15789 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
15790         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
15791         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
15792         return ret_conv;
15793 }
15794
15795 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
15796         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
15797         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
15798         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
15799         return tag_ptr(ret_conv, true);
15800 }
15801
15802 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
15803         LDKBlindedPayInfo o_conv;
15804         o_conv.inner = untag_ptr(o);
15805         o_conv.is_owned = ptr_is_owned(o);
15806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15807         o_conv = BlindedPayInfo_clone(&o_conv);
15808         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15809         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
15810         return tag_ptr(ret_conv, true);
15811 }
15812
15813 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
15814         void* e_ptr = untag_ptr(e);
15815         CHECK_ACCESS(e_ptr);
15816         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15817         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15818         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15819         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
15820         return tag_ptr(ret_conv, true);
15821 }
15822
15823 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
15824         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
15825         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
15826         return ret_conv;
15827 }
15828
15829 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
15830         if (!ptr_is_owned(_res)) return;
15831         void* _res_ptr = untag_ptr(_res);
15832         CHECK_ACCESS(_res_ptr);
15833         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
15834         FREE(untag_ptr(_res));
15835         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
15836 }
15837
15838 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
15839         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15840         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
15841         return tag_ptr(ret_conv, true);
15842 }
15843 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15844         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
15845         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
15846         return ret_conv;
15847 }
15848
15849 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
15850         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
15851         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15852         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
15853         return tag_ptr(ret_conv, true);
15854 }
15855
15856 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15857         LDKDelayedPaymentOutputDescriptor o_conv;
15858         o_conv.inner = untag_ptr(o);
15859         o_conv.is_owned = ptr_is_owned(o);
15860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15861         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15862         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15863         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15864         return tag_ptr(ret_conv, true);
15865 }
15866
15867 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15868         void* e_ptr = untag_ptr(e);
15869         CHECK_ACCESS(e_ptr);
15870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15872         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15873         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15874         return tag_ptr(ret_conv, true);
15875 }
15876
15877 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15878         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15879         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15880         return ret_conv;
15881 }
15882
15883 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15884         if (!ptr_is_owned(_res)) return;
15885         void* _res_ptr = untag_ptr(_res);
15886         CHECK_ACCESS(_res_ptr);
15887         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15888         FREE(untag_ptr(_res));
15889         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15890 }
15891
15892 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15893         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15894         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15895         return tag_ptr(ret_conv, true);
15896 }
15897 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15898         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15899         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15900         return ret_conv;
15901 }
15902
15903 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15904         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15905         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15906         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15907         return tag_ptr(ret_conv, true);
15908 }
15909
15910 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15911         LDKStaticPaymentOutputDescriptor o_conv;
15912         o_conv.inner = untag_ptr(o);
15913         o_conv.is_owned = ptr_is_owned(o);
15914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15915         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15916         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15917         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15918         return tag_ptr(ret_conv, true);
15919 }
15920
15921 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15922         void* e_ptr = untag_ptr(e);
15923         CHECK_ACCESS(e_ptr);
15924         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15925         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15926         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15927         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15928         return tag_ptr(ret_conv, true);
15929 }
15930
15931 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15932         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15933         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15934         return ret_conv;
15935 }
15936
15937 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15938         if (!ptr_is_owned(_res)) return;
15939         void* _res_ptr = untag_ptr(_res);
15940         CHECK_ACCESS(_res_ptr);
15941         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15942         FREE(untag_ptr(_res));
15943         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15944 }
15945
15946 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15947         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15948         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15949         return tag_ptr(ret_conv, true);
15950 }
15951 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15952         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15953         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15954         return ret_conv;
15955 }
15956
15957 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15958         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15959         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15960         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15961         return tag_ptr(ret_conv, true);
15962 }
15963
15964 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15965         void* o_ptr = untag_ptr(o);
15966         CHECK_ACCESS(o_ptr);
15967         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15968         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
15969         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15970         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15971         return tag_ptr(ret_conv, true);
15972 }
15973
15974 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15975         void* e_ptr = untag_ptr(e);
15976         CHECK_ACCESS(e_ptr);
15977         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15978         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15979         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15980         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15981         return tag_ptr(ret_conv, true);
15982 }
15983
15984 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15985         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15986         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15987         return ret_conv;
15988 }
15989
15990 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15991         if (!ptr_is_owned(_res)) return;
15992         void* _res_ptr = untag_ptr(_res);
15993         CHECK_ACCESS(_res_ptr);
15994         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15995         FREE(untag_ptr(_res));
15996         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15997 }
15998
15999 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16000         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16001         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16002         return tag_ptr(ret_conv, true);
16003 }
16004 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16005         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16006         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16007         return ret_conv;
16008 }
16009
16010 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16011         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16012         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16013         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16014         return tag_ptr(ret_conv, true);
16015 }
16016
16017 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
16018         LDKCVec_SpendableOutputDescriptorZ _res_constr;
16019         _res_constr.datalen = _res->arr_len;
16020         if (_res_constr.datalen > 0)
16021                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16022         else
16023                 _res_constr.data = NULL;
16024         uint64_t* _res_vals = _res->elems;
16025         for (size_t b = 0; b < _res_constr.datalen; b++) {
16026                 uint64_t _res_conv_27 = _res_vals[b];
16027                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
16028                 CHECK_ACCESS(_res_conv_27_ptr);
16029                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16030                 FREE(untag_ptr(_res_conv_27));
16031                 _res_constr.data[b] = _res_conv_27_conv;
16032         }
16033         FREE(_res);
16034         CVec_SpendableOutputDescriptorZ_free(_res_constr);
16035 }
16036
16037 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16038         LDKCVec_TxOutZ _res_constr;
16039         _res_constr.datalen = _res->arr_len;
16040         if (_res_constr.datalen > 0)
16041                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16042         else
16043                 _res_constr.data = NULL;
16044         uint64_t* _res_vals = _res->elems;
16045         for (size_t h = 0; h < _res_constr.datalen; h++) {
16046                 uint64_t _res_conv_7 = _res_vals[h];
16047                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16048                 CHECK_ACCESS(_res_conv_7_ptr);
16049                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16050                 FREE(untag_ptr(_res_conv_7));
16051                 _res_constr.data[h] = _res_conv_7_conv;
16052         }
16053         FREE(_res);
16054         CVec_TxOutZ_free(_res_constr);
16055 }
16056
16057 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
16058         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16059         *ret_copy = COption_u32Z_some(o);
16060         uint64_t ret_ref = tag_ptr(ret_copy, true);
16061         return ret_ref;
16062 }
16063
16064 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
16065         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16066         *ret_copy = COption_u32Z_none();
16067         uint64_t ret_ref = tag_ptr(ret_copy, true);
16068         return ret_ref;
16069 }
16070
16071 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
16072         if (!ptr_is_owned(_res)) return;
16073         void* _res_ptr = untag_ptr(_res);
16074         CHECK_ACCESS(_res_ptr);
16075         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
16076         FREE(untag_ptr(_res));
16077         COption_u32Z_free(_res_conv);
16078 }
16079
16080 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
16081         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16082         *ret_copy = COption_u32Z_clone(arg);
16083         uint64_t ret_ref = tag_ptr(ret_copy, true);
16084         return ret_ref;
16085 }
16086 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
16087         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
16088         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
16089         return ret_conv;
16090 }
16091
16092 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
16093         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
16094         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16095         *ret_copy = COption_u32Z_clone(orig_conv);
16096         uint64_t ret_ref = tag_ptr(ret_copy, true);
16097         return ret_ref;
16098 }
16099
16100 static inline uint64_t C2Tuple_CVec_u8ZusizeZ_clone_ptr(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR arg) {
16101         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16102         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(arg);
16103         return tag_ptr(ret_conv, true);
16104 }
16105 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_clone_ptr"))) TS_C2Tuple_CVec_u8ZusizeZ_clone_ptr(uint64_t arg) {
16106         LDKC2Tuple_CVec_u8ZusizeZ* arg_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(arg);
16107         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_clone_ptr(arg_conv);
16108         return ret_conv;
16109 }
16110
16111 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_clone"))) TS_C2Tuple_CVec_u8ZusizeZ_clone(uint64_t orig) {
16112         LDKC2Tuple_CVec_u8ZusizeZ* orig_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(orig);
16113         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16114         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(orig_conv);
16115         return tag_ptr(ret_conv, true);
16116 }
16117
16118 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_new"))) TS_C2Tuple_CVec_u8ZusizeZ_new(int8_tArray a, uint32_t b) {
16119         LDKCVec_u8Z a_ref;
16120         a_ref.datalen = a->arr_len;
16121         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
16122         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
16123         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16124         *ret_conv = C2Tuple_CVec_u8ZusizeZ_new(a_ref, b);
16125         return tag_ptr(ret_conv, true);
16126 }
16127
16128 void  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_free"))) TS_C2Tuple_CVec_u8ZusizeZ_free(uint64_t _res) {
16129         if (!ptr_is_owned(_res)) return;
16130         void* _res_ptr = untag_ptr(_res);
16131         CHECK_ACCESS(_res_ptr);
16132         LDKC2Tuple_CVec_u8ZusizeZ _res_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(_res_ptr);
16133         FREE(untag_ptr(_res));
16134         C2Tuple_CVec_u8ZusizeZ_free(_res_conv);
16135 }
16136
16137 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(uint64_t o) {
16138         void* o_ptr = untag_ptr(o);
16139         CHECK_ACCESS(o_ptr);
16140         LDKC2Tuple_CVec_u8ZusizeZ o_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(o_ptr);
16141         o_conv = C2Tuple_CVec_u8ZusizeZ_clone((LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(o));
16142         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16143         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o_conv);
16144         return tag_ptr(ret_conv, true);
16145 }
16146
16147 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err() {
16148         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16149         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err();
16150         return tag_ptr(ret_conv, true);
16151 }
16152
16153 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(uint64_t o) {
16154         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(o);
16155         jboolean ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o_conv);
16156         return ret_conv;
16157 }
16158
16159 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(uint64_t _res) {
16160         if (!ptr_is_owned(_res)) return;
16161         void* _res_ptr = untag_ptr(_res);
16162         CHECK_ACCESS(_res_ptr);
16163         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)(_res_ptr);
16164         FREE(untag_ptr(_res));
16165         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res_conv);
16166 }
16167
16168 static inline uint64_t CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR arg) {
16169         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16170         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(arg);
16171         return tag_ptr(ret_conv, true);
16172 }
16173 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(uint64_t arg) {
16174         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(arg);
16175         int64_t ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(arg_conv);
16176         return ret_conv;
16177 }
16178
16179 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(uint64_t orig) {
16180         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(orig);
16181         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16182         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig_conv);
16183         return tag_ptr(ret_conv, true);
16184 }
16185
16186 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
16187         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16188         *ret_conv = CResult_NoneNoneZ_ok();
16189         return tag_ptr(ret_conv, true);
16190 }
16191
16192 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
16193         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16194         *ret_conv = CResult_NoneNoneZ_err();
16195         return tag_ptr(ret_conv, true);
16196 }
16197
16198 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
16199         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
16200         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
16201         return ret_conv;
16202 }
16203
16204 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
16205         if (!ptr_is_owned(_res)) return;
16206         void* _res_ptr = untag_ptr(_res);
16207         CHECK_ACCESS(_res_ptr);
16208         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
16209         FREE(untag_ptr(_res));
16210         CResult_NoneNoneZ_free(_res_conv);
16211 }
16212
16213 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
16214         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16215         *ret_conv = CResult_NoneNoneZ_clone(arg);
16216         return tag_ptr(ret_conv, true);
16217 }
16218 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
16219         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
16220         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
16221         return ret_conv;
16222 }
16223
16224 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
16225         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
16226         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16227         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
16228         return tag_ptr(ret_conv, true);
16229 }
16230
16231 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
16232         LDKCVec_ECDSASignatureZ _res_constr;
16233         _res_constr.datalen = _res->arr_len;
16234         if (_res_constr.datalen > 0)
16235                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
16236         else
16237                 _res_constr.data = NULL;
16238         int8_tArray* _res_vals = (void*) _res->elems;
16239         for (size_t m = 0; m < _res_constr.datalen; m++) {
16240                 int8_tArray _res_conv_12 = _res_vals[m];
16241                 LDKECDSASignature _res_conv_12_ref;
16242                 CHECK(_res_conv_12->arr_len == 64);
16243                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
16244                 _res_constr.data[m] = _res_conv_12_ref;
16245         }
16246         FREE(_res);
16247         CVec_ECDSASignatureZ_free(_res_constr);
16248 }
16249
16250 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
16251         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16252         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
16253         return tag_ptr(ret_conv, true);
16254 }
16255 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
16256         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
16257         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
16258         return ret_conv;
16259 }
16260
16261 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
16262         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
16263         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16264         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
16265         return tag_ptr(ret_conv, true);
16266 }
16267
16268 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
16269         LDKECDSASignature a_ref;
16270         CHECK(a->arr_len == 64);
16271         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
16272         LDKCVec_ECDSASignatureZ b_constr;
16273         b_constr.datalen = b->arr_len;
16274         if (b_constr.datalen > 0)
16275                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
16276         else
16277                 b_constr.data = NULL;
16278         int8_tArray* b_vals = (void*) b->elems;
16279         for (size_t m = 0; m < b_constr.datalen; m++) {
16280                 int8_tArray b_conv_12 = b_vals[m];
16281                 LDKECDSASignature b_conv_12_ref;
16282                 CHECK(b_conv_12->arr_len == 64);
16283                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
16284                 b_constr.data[m] = b_conv_12_ref;
16285         }
16286         FREE(b);
16287         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16288         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
16289         return tag_ptr(ret_conv, true);
16290 }
16291
16292 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
16293         if (!ptr_is_owned(_res)) return;
16294         void* _res_ptr = untag_ptr(_res);
16295         CHECK_ACCESS(_res_ptr);
16296         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
16297         FREE(untag_ptr(_res));
16298         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
16299 }
16300
16301 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
16302         void* o_ptr = untag_ptr(o);
16303         CHECK_ACCESS(o_ptr);
16304         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
16305         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
16306         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16307         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
16308         return tag_ptr(ret_conv, true);
16309 }
16310
16311 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
16312         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16313         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
16314         return tag_ptr(ret_conv, true);
16315 }
16316
16317 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
16318         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
16319         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
16320         return ret_conv;
16321 }
16322
16323 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
16324         if (!ptr_is_owned(_res)) return;
16325         void* _res_ptr = untag_ptr(_res);
16326         CHECK_ACCESS(_res_ptr);
16327         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
16328         FREE(untag_ptr(_res));
16329         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
16330 }
16331
16332 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
16333         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16334         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
16335         return tag_ptr(ret_conv, true);
16336 }
16337 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
16338         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
16339         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
16340         return ret_conv;
16341 }
16342
16343 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
16344         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
16345         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16346         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
16347         return tag_ptr(ret_conv, true);
16348 }
16349
16350 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
16351         LDKECDSASignature o_ref;
16352         CHECK(o->arr_len == 64);
16353         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16354         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16355         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
16356         return tag_ptr(ret_conv, true);
16357 }
16358
16359 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
16360         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16361         *ret_conv = CResult_ECDSASignatureNoneZ_err();
16362         return tag_ptr(ret_conv, true);
16363 }
16364
16365 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
16366         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
16367         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
16368         return ret_conv;
16369 }
16370
16371 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
16372         if (!ptr_is_owned(_res)) return;
16373         void* _res_ptr = untag_ptr(_res);
16374         CHECK_ACCESS(_res_ptr);
16375         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
16376         FREE(untag_ptr(_res));
16377         CResult_ECDSASignatureNoneZ_free(_res_conv);
16378 }
16379
16380 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
16381         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16382         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
16383         return tag_ptr(ret_conv, true);
16384 }
16385 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
16386         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
16387         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
16388         return ret_conv;
16389 }
16390
16391 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
16392         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
16393         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16394         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
16395         return tag_ptr(ret_conv, true);
16396 }
16397
16398 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
16399         LDKPublicKey o_ref;
16400         CHECK(o->arr_len == 33);
16401         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
16402         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16403         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
16404         return tag_ptr(ret_conv, true);
16405 }
16406
16407 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
16408         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16409         *ret_conv = CResult_PublicKeyNoneZ_err();
16410         return tag_ptr(ret_conv, true);
16411 }
16412
16413 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
16414         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
16415         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
16416         return ret_conv;
16417 }
16418
16419 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
16420         if (!ptr_is_owned(_res)) return;
16421         void* _res_ptr = untag_ptr(_res);
16422         CHECK_ACCESS(_res_ptr);
16423         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
16424         FREE(untag_ptr(_res));
16425         CResult_PublicKeyNoneZ_free(_res_conv);
16426 }
16427
16428 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
16429         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16430         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
16431         return tag_ptr(ret_conv, true);
16432 }
16433 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
16434         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
16435         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
16436         return ret_conv;
16437 }
16438
16439 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16440         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16441         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16442         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16443         return tag_ptr(ret_conv, true);
16444 }
16445
16446 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
16447         void* o_ptr = untag_ptr(o);
16448         CHECK_ACCESS(o_ptr);
16449         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16450         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16451         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16452         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
16453         uint64_t ret_ref = tag_ptr(ret_copy, true);
16454         return ret_ref;
16455 }
16456
16457 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
16458         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16459         *ret_copy = COption_BigEndianScalarZ_none();
16460         uint64_t ret_ref = tag_ptr(ret_copy, true);
16461         return ret_ref;
16462 }
16463
16464 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
16465         if (!ptr_is_owned(_res)) return;
16466         void* _res_ptr = untag_ptr(_res);
16467         CHECK_ACCESS(_res_ptr);
16468         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
16469         FREE(untag_ptr(_res));
16470         COption_BigEndianScalarZ_free(_res_conv);
16471 }
16472
16473 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
16474         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16475         *ret_copy = COption_BigEndianScalarZ_clone(arg);
16476         uint64_t ret_ref = tag_ptr(ret_copy, true);
16477         return ret_ref;
16478 }
16479 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
16480         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
16481         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
16482         return ret_conv;
16483 }
16484
16485 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
16486         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
16487         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16488         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
16489         uint64_t ret_ref = tag_ptr(ret_copy, true);
16490         return ret_ref;
16491 }
16492
16493 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16494         LDKCVec_U5Z _res_constr;
16495         _res_constr.datalen = _res->arr_len;
16496         if (_res_constr.datalen > 0)
16497                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16498         else
16499                 _res_constr.data = NULL;
16500         int8_t* _res_vals = (void*) _res->elems;
16501         for (size_t h = 0; h < _res_constr.datalen; h++) {
16502                 int8_t _res_conv_7 = _res_vals[h];
16503                 
16504                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16505         }
16506         FREE(_res);
16507         CVec_U5Z_free(_res_constr);
16508 }
16509
16510 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16511         LDKRecoverableSignature o_ref;
16512         CHECK(o->arr_len == 68);
16513         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16514         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16515         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16516         return tag_ptr(ret_conv, true);
16517 }
16518
16519 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16520         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16521         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16522         return tag_ptr(ret_conv, true);
16523 }
16524
16525 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16526         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16527         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16528         return ret_conv;
16529 }
16530
16531 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16532         if (!ptr_is_owned(_res)) return;
16533         void* _res_ptr = untag_ptr(_res);
16534         CHECK_ACCESS(_res_ptr);
16535         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16536         FREE(untag_ptr(_res));
16537         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16538 }
16539
16540 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16541         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16542         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16543         return tag_ptr(ret_conv, true);
16544 }
16545 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16546         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16547         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16548         return ret_conv;
16549 }
16550
16551 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16552         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16553         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16554         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16555         return tag_ptr(ret_conv, true);
16556 }
16557
16558 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
16559         LDKSchnorrSignature o_ref;
16560         CHECK(o->arr_len == 64);
16561         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16562         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16563         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
16564         return tag_ptr(ret_conv, true);
16565 }
16566
16567 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
16568         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16569         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
16570         return tag_ptr(ret_conv, true);
16571 }
16572
16573 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
16574         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
16575         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
16576         return ret_conv;
16577 }
16578
16579 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
16580         if (!ptr_is_owned(_res)) return;
16581         void* _res_ptr = untag_ptr(_res);
16582         CHECK_ACCESS(_res_ptr);
16583         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
16584         FREE(untag_ptr(_res));
16585         CResult_SchnorrSignatureNoneZ_free(_res_conv);
16586 }
16587
16588 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
16589         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16590         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
16591         return tag_ptr(ret_conv, true);
16592 }
16593 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
16594         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
16595         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
16596         return ret_conv;
16597 }
16598
16599 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
16600         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
16601         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16602         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
16603         return tag_ptr(ret_conv, true);
16604 }
16605
16606 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16607         void* o_ptr = untag_ptr(o);
16608         CHECK_ACCESS(o_ptr);
16609         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16610         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16611                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16612                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16613         }
16614         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16615         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16616         return tag_ptr(ret_conv, true);
16617 }
16618
16619 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16620         void* e_ptr = untag_ptr(e);
16621         CHECK_ACCESS(e_ptr);
16622         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16623         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16624         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16625         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16626         return tag_ptr(ret_conv, true);
16627 }
16628
16629 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16630         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16631         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16632         return ret_conv;
16633 }
16634
16635 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16636         if (!ptr_is_owned(_res)) return;
16637         void* _res_ptr = untag_ptr(_res);
16638         CHECK_ACCESS(_res_ptr);
16639         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16640         FREE(untag_ptr(_res));
16641         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16642 }
16643
16644 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16645         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16646         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16647         return tag_ptr(ret_conv, true);
16648 }
16649 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16650         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16651         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16652         return ret_conv;
16653 }
16654
16655 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16656         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16657         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16658         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16659         return tag_ptr(ret_conv, true);
16660 }
16661
16662 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
16663         LDKCVec_u8Z o_ref;
16664         o_ref.datalen = o->arr_len;
16665         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16666         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16667         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16668         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
16669         return tag_ptr(ret_conv, true);
16670 }
16671
16672 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
16673         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16674         *ret_conv = CResult_CVec_u8ZNoneZ_err();
16675         return tag_ptr(ret_conv, true);
16676 }
16677
16678 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
16679         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
16680         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
16681         return ret_conv;
16682 }
16683
16684 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
16685         if (!ptr_is_owned(_res)) return;
16686         void* _res_ptr = untag_ptr(_res);
16687         CHECK_ACCESS(_res_ptr);
16688         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
16689         FREE(untag_ptr(_res));
16690         CResult_CVec_u8ZNoneZ_free(_res_conv);
16691 }
16692
16693 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
16694         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16695         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
16696         return tag_ptr(ret_conv, true);
16697 }
16698 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
16699         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
16700         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
16701         return ret_conv;
16702 }
16703
16704 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
16705         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
16706         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16707         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
16708         return tag_ptr(ret_conv, true);
16709 }
16710
16711 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
16712         LDKShutdownScript o_conv;
16713         o_conv.inner = untag_ptr(o);
16714         o_conv.is_owned = ptr_is_owned(o);
16715         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16716         o_conv = ShutdownScript_clone(&o_conv);
16717         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16718         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
16719         return tag_ptr(ret_conv, true);
16720 }
16721
16722 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
16723         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16724         *ret_conv = CResult_ShutdownScriptNoneZ_err();
16725         return tag_ptr(ret_conv, true);
16726 }
16727
16728 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
16729         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
16730         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
16731         return ret_conv;
16732 }
16733
16734 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
16735         if (!ptr_is_owned(_res)) return;
16736         void* _res_ptr = untag_ptr(_res);
16737         CHECK_ACCESS(_res_ptr);
16738         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
16739         FREE(untag_ptr(_res));
16740         CResult_ShutdownScriptNoneZ_free(_res_conv);
16741 }
16742
16743 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
16744         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16745         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
16746         return tag_ptr(ret_conv, true);
16747 }
16748 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
16749         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
16750         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
16751         return ret_conv;
16752 }
16753
16754 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
16755         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
16756         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16757         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
16758         return tag_ptr(ret_conv, true);
16759 }
16760
16761 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
16762         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16763         *ret_copy = COption_u16Z_some(o);
16764         uint64_t ret_ref = tag_ptr(ret_copy, true);
16765         return ret_ref;
16766 }
16767
16768 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
16769         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16770         *ret_copy = COption_u16Z_none();
16771         uint64_t ret_ref = tag_ptr(ret_copy, true);
16772         return ret_ref;
16773 }
16774
16775 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
16776         if (!ptr_is_owned(_res)) return;
16777         void* _res_ptr = untag_ptr(_res);
16778         CHECK_ACCESS(_res_ptr);
16779         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
16780         FREE(untag_ptr(_res));
16781         COption_u16Z_free(_res_conv);
16782 }
16783
16784 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
16785         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16786         *ret_copy = COption_u16Z_clone(arg);
16787         uint64_t ret_ref = tag_ptr(ret_copy, true);
16788         return ret_ref;
16789 }
16790 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
16791         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
16792         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
16793         return ret_conv;
16794 }
16795
16796 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
16797         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
16798         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16799         *ret_copy = COption_u16Z_clone(orig_conv);
16800         uint64_t ret_ref = tag_ptr(ret_copy, true);
16801         return ret_ref;
16802 }
16803
16804 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
16805         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
16806         *ret_copy = COption_boolZ_some(o);
16807         uint64_t ret_ref = tag_ptr(ret_copy, true);
16808         return ret_ref;
16809 }
16810
16811 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
16812         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
16813         *ret_copy = COption_boolZ_none();
16814         uint64_t ret_ref = tag_ptr(ret_copy, true);
16815         return ret_ref;
16816 }
16817
16818 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
16819         if (!ptr_is_owned(_res)) return;
16820         void* _res_ptr = untag_ptr(_res);
16821         CHECK_ACCESS(_res_ptr);
16822         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
16823         FREE(untag_ptr(_res));
16824         COption_boolZ_free(_res_conv);
16825 }
16826
16827 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
16828         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
16829         *ret_copy = COption_boolZ_clone(arg);
16830         uint64_t ret_ref = tag_ptr(ret_copy, true);
16831         return ret_ref;
16832 }
16833 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
16834         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
16835         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
16836         return ret_conv;
16837 }
16838
16839 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
16840         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
16841         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
16842         *ret_copy = COption_boolZ_clone(orig_conv);
16843         uint64_t ret_ref = tag_ptr(ret_copy, true);
16844         return ret_ref;
16845 }
16846
16847 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16848         LDKCVec_CVec_u8ZZ _res_constr;
16849         _res_constr.datalen = _res->arr_len;
16850         if (_res_constr.datalen > 0)
16851                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16852         else
16853                 _res_constr.data = NULL;
16854         int8_tArray* _res_vals = (void*) _res->elems;
16855         for (size_t m = 0; m < _res_constr.datalen; m++) {
16856                 int8_tArray _res_conv_12 = _res_vals[m];
16857                 LDKCVec_u8Z _res_conv_12_ref;
16858                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16859                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16860                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16861                 _res_constr.data[m] = _res_conv_12_ref;
16862         }
16863         FREE(_res);
16864         CVec_CVec_u8ZZ_free(_res_constr);
16865 }
16866
16867 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16868         LDKCVec_CVec_u8ZZ o_constr;
16869         o_constr.datalen = o->arr_len;
16870         if (o_constr.datalen > 0)
16871                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16872         else
16873                 o_constr.data = NULL;
16874         int8_tArray* o_vals = (void*) o->elems;
16875         for (size_t m = 0; m < o_constr.datalen; m++) {
16876                 int8_tArray o_conv_12 = o_vals[m];
16877                 LDKCVec_u8Z o_conv_12_ref;
16878                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16879                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16880                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16881                 o_constr.data[m] = o_conv_12_ref;
16882         }
16883         FREE(o);
16884         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16885         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16886         return tag_ptr(ret_conv, true);
16887 }
16888
16889 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16890         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16891         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16892         return tag_ptr(ret_conv, true);
16893 }
16894
16895 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16896         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16897         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16898         return ret_conv;
16899 }
16900
16901 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16902         if (!ptr_is_owned(_res)) return;
16903         void* _res_ptr = untag_ptr(_res);
16904         CHECK_ACCESS(_res_ptr);
16905         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16906         FREE(untag_ptr(_res));
16907         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16908 }
16909
16910 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16911         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16912         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16913         return tag_ptr(ret_conv, true);
16914 }
16915 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16916         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16917         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16918         return ret_conv;
16919 }
16920
16921 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16922         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16923         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16924         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16925         return tag_ptr(ret_conv, true);
16926 }
16927
16928 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16929         LDKInMemorySigner o_conv;
16930         o_conv.inner = untag_ptr(o);
16931         o_conv.is_owned = ptr_is_owned(o);
16932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16933         o_conv = InMemorySigner_clone(&o_conv);
16934         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16935         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16936         return tag_ptr(ret_conv, true);
16937 }
16938
16939 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16940         void* e_ptr = untag_ptr(e);
16941         CHECK_ACCESS(e_ptr);
16942         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16943         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16944         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16945         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16946         return tag_ptr(ret_conv, true);
16947 }
16948
16949 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16950         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16951         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16952         return ret_conv;
16953 }
16954
16955 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16956         if (!ptr_is_owned(_res)) return;
16957         void* _res_ptr = untag_ptr(_res);
16958         CHECK_ACCESS(_res_ptr);
16959         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16960         FREE(untag_ptr(_res));
16961         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16962 }
16963
16964 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16965         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16966         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16967         return tag_ptr(ret_conv, true);
16968 }
16969 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16970         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16971         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16972         return ret_conv;
16973 }
16974
16975 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16976         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16977         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16978         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16979         return tag_ptr(ret_conv, true);
16980 }
16981
16982 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16983         LDKTransaction o_ref;
16984         o_ref.datalen = o->arr_len;
16985         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16986         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16987         o_ref.data_is_owned = true;
16988         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16989         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16990         return tag_ptr(ret_conv, true);
16991 }
16992
16993 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16994         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16995         *ret_conv = CResult_TransactionNoneZ_err();
16996         return tag_ptr(ret_conv, true);
16997 }
16998
16999 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
17000         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
17001         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
17002         return ret_conv;
17003 }
17004
17005 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
17006         if (!ptr_is_owned(_res)) return;
17007         void* _res_ptr = untag_ptr(_res);
17008         CHECK_ACCESS(_res_ptr);
17009         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
17010         FREE(untag_ptr(_res));
17011         CResult_TransactionNoneZ_free(_res_conv);
17012 }
17013
17014 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
17015         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17016         *ret_conv = CResult_TransactionNoneZ_clone(arg);
17017         return tag_ptr(ret_conv, true);
17018 }
17019 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
17020         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
17021         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17022         return ret_conv;
17023 }
17024
17025 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
17026         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
17027         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17028         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17029         return tag_ptr(ret_conv, true);
17030 }
17031
17032 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
17033         LDKCVec_ChannelDetailsZ _res_constr;
17034         _res_constr.datalen = _res->arr_len;
17035         if (_res_constr.datalen > 0)
17036                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17037         else
17038                 _res_constr.data = NULL;
17039         uint64_t* _res_vals = _res->elems;
17040         for (size_t q = 0; q < _res_constr.datalen; q++) {
17041                 uint64_t _res_conv_16 = _res_vals[q];
17042                 LDKChannelDetails _res_conv_16_conv;
17043                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17044                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17045                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17046                 _res_constr.data[q] = _res_conv_16_conv;
17047         }
17048         FREE(_res);
17049         CVec_ChannelDetailsZ_free(_res_constr);
17050 }
17051
17052 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
17053         LDKRoute o_conv;
17054         o_conv.inner = untag_ptr(o);
17055         o_conv.is_owned = ptr_is_owned(o);
17056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17057         o_conv = Route_clone(&o_conv);
17058         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17059         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
17060         return tag_ptr(ret_conv, true);
17061 }
17062
17063 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
17064         LDKLightningError e_conv;
17065         e_conv.inner = untag_ptr(e);
17066         e_conv.is_owned = ptr_is_owned(e);
17067         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17068         e_conv = LightningError_clone(&e_conv);
17069         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17070         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
17071         return tag_ptr(ret_conv, true);
17072 }
17073
17074 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
17075         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
17076         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
17077         return ret_conv;
17078 }
17079
17080 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
17081         if (!ptr_is_owned(_res)) return;
17082         void* _res_ptr = untag_ptr(_res);
17083         CHECK_ACCESS(_res_ptr);
17084         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
17085         FREE(untag_ptr(_res));
17086         CResult_RouteLightningErrorZ_free(_res_conv);
17087 }
17088
17089 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
17090         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17091         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
17092         return tag_ptr(ret_conv, true);
17093 }
17094 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
17095         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
17096         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
17097         return ret_conv;
17098 }
17099
17100 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
17101         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
17102         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17103         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
17104         return tag_ptr(ret_conv, true);
17105 }
17106
17107 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
17108         LDKInFlightHtlcs o_conv;
17109         o_conv.inner = untag_ptr(o);
17110         o_conv.is_owned = ptr_is_owned(o);
17111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17112         o_conv = InFlightHtlcs_clone(&o_conv);
17113         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17114         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
17115         return tag_ptr(ret_conv, true);
17116 }
17117
17118 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
17119         void* e_ptr = untag_ptr(e);
17120         CHECK_ACCESS(e_ptr);
17121         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17122         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17123         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17124         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
17125         return tag_ptr(ret_conv, true);
17126 }
17127
17128 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
17129         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
17130         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
17131         return ret_conv;
17132 }
17133
17134 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
17135         if (!ptr_is_owned(_res)) return;
17136         void* _res_ptr = untag_ptr(_res);
17137         CHECK_ACCESS(_res_ptr);
17138         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
17139         FREE(untag_ptr(_res));
17140         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17141 }
17142
17143 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
17144         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17145         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
17146         return tag_ptr(ret_conv, true);
17147 }
17148 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
17149         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
17150         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
17151         return ret_conv;
17152 }
17153
17154 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
17155         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
17156         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17157         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
17158         return tag_ptr(ret_conv, true);
17159 }
17160
17161 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
17162         LDKRouteHop o_conv;
17163         o_conv.inner = untag_ptr(o);
17164         o_conv.is_owned = ptr_is_owned(o);
17165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17166         o_conv = RouteHop_clone(&o_conv);
17167         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17168         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
17169         return tag_ptr(ret_conv, true);
17170 }
17171
17172 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
17173         void* e_ptr = untag_ptr(e);
17174         CHECK_ACCESS(e_ptr);
17175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17177         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17178         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
17179         return tag_ptr(ret_conv, true);
17180 }
17181
17182 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
17183         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
17184         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
17185         return ret_conv;
17186 }
17187
17188 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
17189         if (!ptr_is_owned(_res)) return;
17190         void* _res_ptr = untag_ptr(_res);
17191         CHECK_ACCESS(_res_ptr);
17192         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
17193         FREE(untag_ptr(_res));
17194         CResult_RouteHopDecodeErrorZ_free(_res_conv);
17195 }
17196
17197 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
17198         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17199         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
17200         return tag_ptr(ret_conv, true);
17201 }
17202 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17203         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
17204         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
17205         return ret_conv;
17206 }
17207
17208 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
17209         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
17210         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17211         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
17212         return tag_ptr(ret_conv, true);
17213 }
17214
17215 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
17216         LDKCVec_BlindedHopZ _res_constr;
17217         _res_constr.datalen = _res->arr_len;
17218         if (_res_constr.datalen > 0)
17219                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
17220         else
17221                 _res_constr.data = NULL;
17222         uint64_t* _res_vals = _res->elems;
17223         for (size_t m = 0; m < _res_constr.datalen; m++) {
17224                 uint64_t _res_conv_12 = _res_vals[m];
17225                 LDKBlindedHop _res_conv_12_conv;
17226                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
17227                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
17228                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
17229                 _res_constr.data[m] = _res_conv_12_conv;
17230         }
17231         FREE(_res);
17232         CVec_BlindedHopZ_free(_res_constr);
17233 }
17234
17235 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
17236         LDKBlindedTail o_conv;
17237         o_conv.inner = untag_ptr(o);
17238         o_conv.is_owned = ptr_is_owned(o);
17239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17240         o_conv = BlindedTail_clone(&o_conv);
17241         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17242         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
17243         return tag_ptr(ret_conv, true);
17244 }
17245
17246 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
17247         void* e_ptr = untag_ptr(e);
17248         CHECK_ACCESS(e_ptr);
17249         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17250         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17251         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17252         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
17253         return tag_ptr(ret_conv, true);
17254 }
17255
17256 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
17257         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
17258         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
17259         return ret_conv;
17260 }
17261
17262 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
17263         if (!ptr_is_owned(_res)) return;
17264         void* _res_ptr = untag_ptr(_res);
17265         CHECK_ACCESS(_res_ptr);
17266         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
17267         FREE(untag_ptr(_res));
17268         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
17269 }
17270
17271 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
17272         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17273         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
17274         return tag_ptr(ret_conv, true);
17275 }
17276 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
17277         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
17278         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
17279         return ret_conv;
17280 }
17281
17282 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
17283         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
17284         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17285         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
17286         return tag_ptr(ret_conv, true);
17287 }
17288
17289 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
17290         LDKCVec_RouteHopZ _res_constr;
17291         _res_constr.datalen = _res->arr_len;
17292         if (_res_constr.datalen > 0)
17293                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17294         else
17295                 _res_constr.data = NULL;
17296         uint64_t* _res_vals = _res->elems;
17297         for (size_t k = 0; k < _res_constr.datalen; k++) {
17298                 uint64_t _res_conv_10 = _res_vals[k];
17299                 LDKRouteHop _res_conv_10_conv;
17300                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
17301                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
17302                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
17303                 _res_constr.data[k] = _res_conv_10_conv;
17304         }
17305         FREE(_res);
17306         CVec_RouteHopZ_free(_res_constr);
17307 }
17308
17309 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
17310         LDKCVec_PathZ _res_constr;
17311         _res_constr.datalen = _res->arr_len;
17312         if (_res_constr.datalen > 0)
17313                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
17314         else
17315                 _res_constr.data = NULL;
17316         uint64_t* _res_vals = _res->elems;
17317         for (size_t g = 0; g < _res_constr.datalen; g++) {
17318                 uint64_t _res_conv_6 = _res_vals[g];
17319                 LDKPath _res_conv_6_conv;
17320                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
17321                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
17322                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
17323                 _res_constr.data[g] = _res_conv_6_conv;
17324         }
17325         FREE(_res);
17326         CVec_PathZ_free(_res_constr);
17327 }
17328
17329 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
17330         LDKRoute o_conv;
17331         o_conv.inner = untag_ptr(o);
17332         o_conv.is_owned = ptr_is_owned(o);
17333         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17334         o_conv = Route_clone(&o_conv);
17335         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17336         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
17337         return tag_ptr(ret_conv, true);
17338 }
17339
17340 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
17341         void* e_ptr = untag_ptr(e);
17342         CHECK_ACCESS(e_ptr);
17343         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17344         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17345         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17346         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
17347         return tag_ptr(ret_conv, true);
17348 }
17349
17350 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
17351         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
17352         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
17353         return ret_conv;
17354 }
17355
17356 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
17357         if (!ptr_is_owned(_res)) return;
17358         void* _res_ptr = untag_ptr(_res);
17359         CHECK_ACCESS(_res_ptr);
17360         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
17361         FREE(untag_ptr(_res));
17362         CResult_RouteDecodeErrorZ_free(_res_conv);
17363 }
17364
17365 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
17366         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17367         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
17368         return tag_ptr(ret_conv, true);
17369 }
17370 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
17371         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
17372         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
17373         return ret_conv;
17374 }
17375
17376 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
17377         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
17378         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17379         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
17380         return tag_ptr(ret_conv, true);
17381 }
17382
17383 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
17384         LDKRouteParameters o_conv;
17385         o_conv.inner = untag_ptr(o);
17386         o_conv.is_owned = ptr_is_owned(o);
17387         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17388         o_conv = RouteParameters_clone(&o_conv);
17389         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17390         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
17391         return tag_ptr(ret_conv, true);
17392 }
17393
17394 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
17395         void* e_ptr = untag_ptr(e);
17396         CHECK_ACCESS(e_ptr);
17397         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17398         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17399         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17400         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
17401         return tag_ptr(ret_conv, true);
17402 }
17403
17404 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
17405         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
17406         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
17407         return ret_conv;
17408 }
17409
17410 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
17411         if (!ptr_is_owned(_res)) return;
17412         void* _res_ptr = untag_ptr(_res);
17413         CHECK_ACCESS(_res_ptr);
17414         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
17415         FREE(untag_ptr(_res));
17416         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
17417 }
17418
17419 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
17420         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17421         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
17422         return tag_ptr(ret_conv, true);
17423 }
17424 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17425         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
17426         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
17427         return ret_conv;
17428 }
17429
17430 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
17431         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
17432         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17433         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
17434         return tag_ptr(ret_conv, true);
17435 }
17436
17437 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
17438         LDKCVec_u64Z _res_constr;
17439         _res_constr.datalen = _res->arr_len;
17440         if (_res_constr.datalen > 0)
17441                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17442         else
17443                 _res_constr.data = NULL;
17444         int64_t* _res_vals = _res->elems;
17445         for (size_t i = 0; i < _res_constr.datalen; i++) {
17446                 int64_t _res_conv_8 = _res_vals[i];
17447                 _res_constr.data[i] = _res_conv_8;
17448         }
17449         FREE(_res);
17450         CVec_u64Z_free(_res_constr);
17451 }
17452
17453 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
17454         LDKPaymentParameters o_conv;
17455         o_conv.inner = untag_ptr(o);
17456         o_conv.is_owned = ptr_is_owned(o);
17457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17458         o_conv = PaymentParameters_clone(&o_conv);
17459         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17460         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
17461         return tag_ptr(ret_conv, true);
17462 }
17463
17464 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
17465         void* e_ptr = untag_ptr(e);
17466         CHECK_ACCESS(e_ptr);
17467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17469         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17470         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
17471         return tag_ptr(ret_conv, true);
17472 }
17473
17474 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
17475         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
17476         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
17477         return ret_conv;
17478 }
17479
17480 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
17481         if (!ptr_is_owned(_res)) return;
17482         void* _res_ptr = untag_ptr(_res);
17483         CHECK_ACCESS(_res_ptr);
17484         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
17485         FREE(untag_ptr(_res));
17486         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
17487 }
17488
17489 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
17490         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17491         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
17492         return tag_ptr(ret_conv, true);
17493 }
17494 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17495         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
17496         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
17497         return ret_conv;
17498 }
17499
17500 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
17501         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
17502         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17503         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
17504         return tag_ptr(ret_conv, true);
17505 }
17506
17507 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
17508         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17509         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
17510         return tag_ptr(ret_conv, true);
17511 }
17512 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
17513         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
17514         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
17515         return ret_conv;
17516 }
17517
17518 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
17519         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
17520         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17521         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
17522         return tag_ptr(ret_conv, true);
17523 }
17524
17525 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
17526         LDKBlindedPayInfo a_conv;
17527         a_conv.inner = untag_ptr(a);
17528         a_conv.is_owned = ptr_is_owned(a);
17529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17530         a_conv = BlindedPayInfo_clone(&a_conv);
17531         LDKBlindedPath b_conv;
17532         b_conv.inner = untag_ptr(b);
17533         b_conv.is_owned = ptr_is_owned(b);
17534         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17535         b_conv = BlindedPath_clone(&b_conv);
17536         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17537         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
17538         return tag_ptr(ret_conv, true);
17539 }
17540
17541 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
17542         if (!ptr_is_owned(_res)) return;
17543         void* _res_ptr = untag_ptr(_res);
17544         CHECK_ACCESS(_res_ptr);
17545         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
17546         FREE(untag_ptr(_res));
17547         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
17548 }
17549
17550 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
17551         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
17552         _res_constr.datalen = _res->arr_len;
17553         if (_res_constr.datalen > 0)
17554                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
17555         else
17556                 _res_constr.data = NULL;
17557         uint64_t* _res_vals = _res->elems;
17558         for (size_t l = 0; l < _res_constr.datalen; l++) {
17559                 uint64_t _res_conv_37 = _res_vals[l];
17560                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
17561                 CHECK_ACCESS(_res_conv_37_ptr);
17562                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
17563                 FREE(untag_ptr(_res_conv_37));
17564                 _res_constr.data[l] = _res_conv_37_conv;
17565         }
17566         FREE(_res);
17567         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
17568 }
17569
17570 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
17571         LDKCVec_RouteHintZ _res_constr;
17572         _res_constr.datalen = _res->arr_len;
17573         if (_res_constr.datalen > 0)
17574                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17575         else
17576                 _res_constr.data = NULL;
17577         uint64_t* _res_vals = _res->elems;
17578         for (size_t l = 0; l < _res_constr.datalen; l++) {
17579                 uint64_t _res_conv_11 = _res_vals[l];
17580                 LDKRouteHint _res_conv_11_conv;
17581                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
17582                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
17583                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
17584                 _res_constr.data[l] = _res_conv_11_conv;
17585         }
17586         FREE(_res);
17587         CVec_RouteHintZ_free(_res_constr);
17588 }
17589
17590 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
17591         LDKCVec_RouteHintHopZ _res_constr;
17592         _res_constr.datalen = _res->arr_len;
17593         if (_res_constr.datalen > 0)
17594                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
17595         else
17596                 _res_constr.data = NULL;
17597         uint64_t* _res_vals = _res->elems;
17598         for (size_t o = 0; o < _res_constr.datalen; o++) {
17599                 uint64_t _res_conv_14 = _res_vals[o];
17600                 LDKRouteHintHop _res_conv_14_conv;
17601                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17602                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17603                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17604                 _res_constr.data[o] = _res_conv_14_conv;
17605         }
17606         FREE(_res);
17607         CVec_RouteHintHopZ_free(_res_constr);
17608 }
17609
17610 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
17611         LDKRouteHint o_conv;
17612         o_conv.inner = untag_ptr(o);
17613         o_conv.is_owned = ptr_is_owned(o);
17614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17615         o_conv = RouteHint_clone(&o_conv);
17616         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17617         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
17618         return tag_ptr(ret_conv, true);
17619 }
17620
17621 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
17622         void* e_ptr = untag_ptr(e);
17623         CHECK_ACCESS(e_ptr);
17624         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17625         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17626         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17627         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
17628         return tag_ptr(ret_conv, true);
17629 }
17630
17631 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
17632         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
17633         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
17634         return ret_conv;
17635 }
17636
17637 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
17638         if (!ptr_is_owned(_res)) return;
17639         void* _res_ptr = untag_ptr(_res);
17640         CHECK_ACCESS(_res_ptr);
17641         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
17642         FREE(untag_ptr(_res));
17643         CResult_RouteHintDecodeErrorZ_free(_res_conv);
17644 }
17645
17646 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
17647         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17648         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
17649         return tag_ptr(ret_conv, true);
17650 }
17651 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
17652         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
17653         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
17654         return ret_conv;
17655 }
17656
17657 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
17658         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
17659         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17660         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
17661         return tag_ptr(ret_conv, true);
17662 }
17663
17664 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
17665         LDKRouteHintHop o_conv;
17666         o_conv.inner = untag_ptr(o);
17667         o_conv.is_owned = ptr_is_owned(o);
17668         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17669         o_conv = RouteHintHop_clone(&o_conv);
17670         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17671         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
17672         return tag_ptr(ret_conv, true);
17673 }
17674
17675 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
17676         void* e_ptr = untag_ptr(e);
17677         CHECK_ACCESS(e_ptr);
17678         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17679         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17680         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17681         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
17682         return tag_ptr(ret_conv, true);
17683 }
17684
17685 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
17686         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
17687         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
17688         return ret_conv;
17689 }
17690
17691 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
17692         if (!ptr_is_owned(_res)) return;
17693         void* _res_ptr = untag_ptr(_res);
17694         CHECK_ACCESS(_res_ptr);
17695         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
17696         FREE(untag_ptr(_res));
17697         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
17698 }
17699
17700 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
17701         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17702         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
17703         return tag_ptr(ret_conv, true);
17704 }
17705 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17706         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
17707         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
17708         return ret_conv;
17709 }
17710
17711 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
17712         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
17713         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17714         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
17715         return tag_ptr(ret_conv, true);
17716 }
17717
17718 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
17719         LDKCVec_PublicKeyZ _res_constr;
17720         _res_constr.datalen = _res->arr_len;
17721         if (_res_constr.datalen > 0)
17722                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
17723         else
17724                 _res_constr.data = NULL;
17725         int8_tArray* _res_vals = (void*) _res->elems;
17726         for (size_t m = 0; m < _res_constr.datalen; m++) {
17727                 int8_tArray _res_conv_12 = _res_vals[m];
17728                 LDKPublicKey _res_conv_12_ref;
17729                 CHECK(_res_conv_12->arr_len == 33);
17730                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
17731                 _res_constr.data[m] = _res_conv_12_ref;
17732         }
17733         FREE(_res);
17734         CVec_PublicKeyZ_free(_res_constr);
17735 }
17736
17737 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
17738         LDKFixedPenaltyScorer o_conv;
17739         o_conv.inner = untag_ptr(o);
17740         o_conv.is_owned = ptr_is_owned(o);
17741         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17742         o_conv = FixedPenaltyScorer_clone(&o_conv);
17743         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17744         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
17745         return tag_ptr(ret_conv, true);
17746 }
17747
17748 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
17749         void* e_ptr = untag_ptr(e);
17750         CHECK_ACCESS(e_ptr);
17751         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17752         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17753         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17754         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
17755         return tag_ptr(ret_conv, true);
17756 }
17757
17758 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
17759         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
17760         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
17761         return ret_conv;
17762 }
17763
17764 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
17765         if (!ptr_is_owned(_res)) return;
17766         void* _res_ptr = untag_ptr(_res);
17767         CHECK_ACCESS(_res_ptr);
17768         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
17769         FREE(untag_ptr(_res));
17770         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
17771 }
17772
17773 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
17774         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17775         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
17776         return tag_ptr(ret_conv, true);
17777 }
17778 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
17779         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
17780         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
17781         return ret_conv;
17782 }
17783
17784 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
17785         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
17786         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17787         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
17788         return tag_ptr(ret_conv, true);
17789 }
17790
17791 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
17792         LDKCVec_NodeIdZ _res_constr;
17793         _res_constr.datalen = _res->arr_len;
17794         if (_res_constr.datalen > 0)
17795                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
17796         else
17797                 _res_constr.data = NULL;
17798         uint64_t* _res_vals = _res->elems;
17799         for (size_t i = 0; i < _res_constr.datalen; i++) {
17800                 uint64_t _res_conv_8 = _res_vals[i];
17801                 LDKNodeId _res_conv_8_conv;
17802                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
17803                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
17804                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
17805                 _res_constr.data[i] = _res_conv_8_conv;
17806         }
17807         FREE(_res);
17808         CVec_NodeIdZ_free(_res_constr);
17809 }
17810
17811 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
17812         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17813         *ret_conv = C2Tuple_u64u64Z_clone(arg);
17814         return tag_ptr(ret_conv, true);
17815 }
17816 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
17817         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
17818         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
17819         return ret_conv;
17820 }
17821
17822 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
17823         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
17824         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17825         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
17826         return tag_ptr(ret_conv, true);
17827 }
17828
17829 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
17830         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17831         *ret_conv = C2Tuple_u64u64Z_new(a, b);
17832         return tag_ptr(ret_conv, true);
17833 }
17834
17835 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
17836         if (!ptr_is_owned(_res)) return;
17837         void* _res_ptr = untag_ptr(_res);
17838         CHECK_ACCESS(_res_ptr);
17839         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
17840         FREE(untag_ptr(_res));
17841         C2Tuple_u64u64Z_free(_res_conv);
17842 }
17843
17844 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
17845         void* o_ptr = untag_ptr(o);
17846         CHECK_ACCESS(o_ptr);
17847         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
17848         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
17849         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17850         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
17851         uint64_t ret_ref = tag_ptr(ret_copy, true);
17852         return ret_ref;
17853 }
17854
17855 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
17856         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17857         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
17858         uint64_t ret_ref = tag_ptr(ret_copy, true);
17859         return ret_ref;
17860 }
17861
17862 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
17863         if (!ptr_is_owned(_res)) return;
17864         void* _res_ptr = untag_ptr(_res);
17865         CHECK_ACCESS(_res_ptr);
17866         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
17867         FREE(untag_ptr(_res));
17868         COption_C2Tuple_u64u64ZZ_free(_res_conv);
17869 }
17870
17871 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
17872         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17873         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
17874         uint64_t ret_ref = tag_ptr(ret_copy, true);
17875         return ret_ref;
17876 }
17877 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
17878         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
17879         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
17880         return ret_conv;
17881 }
17882
17883 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
17884         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
17885         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17886         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
17887         uint64_t ret_ref = tag_ptr(ret_copy, true);
17888         return ret_ref;
17889 }
17890
17891 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
17892         LDKThirtyTwoU16s a_ref;
17893         CHECK(a->arr_len == 32);
17894         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
17895         LDKThirtyTwoU16s b_ref;
17896         CHECK(b->arr_len == 32);
17897         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
17898         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
17899         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
17900         return tag_ptr(ret_conv, true);
17901 }
17902
17903 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
17904         if (!ptr_is_owned(_res)) return;
17905         void* _res_ptr = untag_ptr(_res);
17906         CHECK_ACCESS(_res_ptr);
17907         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
17908         FREE(untag_ptr(_res));
17909         C2Tuple_Z_free(_res_conv);
17910 }
17911
17912 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
17913         LDKThirtyTwoU16s a_ref;
17914         CHECK(a->arr_len == 32);
17915         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
17916         LDKThirtyTwoU16s b_ref;
17917         CHECK(b->arr_len == 32);
17918         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
17919         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
17920         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
17921         return tag_ptr(ret_conv, true);
17922 }
17923
17924 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
17925         if (!ptr_is_owned(_res)) return;
17926         void* _res_ptr = untag_ptr(_res);
17927         CHECK_ACCESS(_res_ptr);
17928         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
17929         FREE(untag_ptr(_res));
17930         C2Tuple__u1632_u1632Z_free(_res_conv);
17931 }
17932
17933 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
17934         void* o_ptr = untag_ptr(o);
17935         CHECK_ACCESS(o_ptr);
17936         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
17937         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
17938         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
17939         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
17940         uint64_t ret_ref = tag_ptr(ret_copy, true);
17941         return ret_ref;
17942 }
17943
17944 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
17945         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
17946         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
17947         uint64_t ret_ref = tag_ptr(ret_copy, true);
17948         return ret_ref;
17949 }
17950
17951 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
17952         if (!ptr_is_owned(_res)) return;
17953         void* _res_ptr = untag_ptr(_res);
17954         CHECK_ACCESS(_res_ptr);
17955         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
17956         FREE(untag_ptr(_res));
17957         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
17958 }
17959
17960 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
17961         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
17962         *ret_copy = COption_f64Z_some(o);
17963         uint64_t ret_ref = tag_ptr(ret_copy, true);
17964         return ret_ref;
17965 }
17966
17967 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
17968         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
17969         *ret_copy = COption_f64Z_none();
17970         uint64_t ret_ref = tag_ptr(ret_copy, true);
17971         return ret_ref;
17972 }
17973
17974 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_free(uint64_t _res) {
17975         if (!ptr_is_owned(_res)) return;
17976         void* _res_ptr = untag_ptr(_res);
17977         CHECK_ACCESS(_res_ptr);
17978         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
17979         FREE(untag_ptr(_res));
17980         COption_f64Z_free(_res_conv);
17981 }
17982
17983 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
17984         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
17985         *ret_copy = COption_f64Z_clone(arg);
17986         uint64_t ret_ref = tag_ptr(ret_copy, true);
17987         return ret_ref;
17988 }
17989 int64_t  __attribute__((export_name("TS_COption_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
17990         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
17991         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
17992         return ret_conv;
17993 }
17994
17995 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
17996         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
17997         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
17998         *ret_copy = COption_f64Z_clone(orig_conv);
17999         uint64_t ret_ref = tag_ptr(ret_copy, true);
18000         return ret_ref;
18001 }
18002
18003 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
18004         LDKProbabilisticScorer o_conv;
18005         o_conv.inner = untag_ptr(o);
18006         o_conv.is_owned = ptr_is_owned(o);
18007         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18008         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
18009         
18010         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18011         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
18012         return tag_ptr(ret_conv, true);
18013 }
18014
18015 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
18016         void* e_ptr = untag_ptr(e);
18017         CHECK_ACCESS(e_ptr);
18018         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18019         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18020         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18021         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
18022         return tag_ptr(ret_conv, true);
18023 }
18024
18025 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
18026         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
18027         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
18028         return ret_conv;
18029 }
18030
18031 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
18032         if (!ptr_is_owned(_res)) return;
18033         void* _res_ptr = untag_ptr(_res);
18034         CHECK_ACCESS(_res_ptr);
18035         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
18036         FREE(untag_ptr(_res));
18037         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
18038 }
18039
18040 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
18041         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18042         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
18043         return tag_ptr(ret_conv, true);
18044 }
18045 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
18046         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
18047         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
18048         return ret_conv;
18049 }
18050
18051 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
18052         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
18053         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18054         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
18055         return tag_ptr(ret_conv, true);
18056 }
18057
18058 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
18059         LDKTransaction b_ref;
18060         b_ref.datalen = b->arr_len;
18061         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
18062         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18063         b_ref.data_is_owned = true;
18064         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18065         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
18066         return tag_ptr(ret_conv, true);
18067 }
18068
18069 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
18070         if (!ptr_is_owned(_res)) return;
18071         void* _res_ptr = untag_ptr(_res);
18072         CHECK_ACCESS(_res_ptr);
18073         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
18074         FREE(untag_ptr(_res));
18075         C2Tuple_usizeTransactionZ_free(_res_conv);
18076 }
18077
18078 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
18079         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
18080         _res_constr.datalen = _res->arr_len;
18081         if (_res_constr.datalen > 0)
18082                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18083         else
18084                 _res_constr.data = NULL;
18085         uint64_t* _res_vals = _res->elems;
18086         for (size_t c = 0; c < _res_constr.datalen; c++) {
18087                 uint64_t _res_conv_28 = _res_vals[c];
18088                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
18089                 CHECK_ACCESS(_res_conv_28_ptr);
18090                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
18091                 FREE(untag_ptr(_res_conv_28));
18092                 _res_constr.data[c] = _res_conv_28_conv;
18093         }
18094         FREE(_res);
18095         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
18096 }
18097
18098 static inline uint64_t C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
18099         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18100         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(arg);
18101         return tag_ptr(ret_conv, true);
18102 }
18103 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
18104         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(arg);
18105         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
18106         return ret_conv;
18107 }
18108
18109 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
18110         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(orig);
18111         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18112         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig_conv);
18113         return tag_ptr(ret_conv, true);
18114 }
18115
18116 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(int8_tArray a, uint64_t b) {
18117         LDKThirtyTwoBytes a_ref;
18118         CHECK(a->arr_len == 32);
18119         memcpy(a_ref.data, a->elems, 32); FREE(a);
18120         void* b_ptr = untag_ptr(b);
18121         CHECK_ACCESS(b_ptr);
18122         LDKCOption_ThirtyTwoBytesZ b_conv = *(LDKCOption_ThirtyTwoBytesZ*)(b_ptr);
18123         b_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(b));
18124         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18125         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a_ref, b_conv);
18126         return tag_ptr(ret_conv, true);
18127 }
18128
18129 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(uint64_t _res) {
18130         if (!ptr_is_owned(_res)) return;
18131         void* _res_ptr = untag_ptr(_res);
18132         CHECK_ACCESS(_res_ptr);
18133         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_ptr);
18134         FREE(untag_ptr(_res));
18135         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res_conv);
18136 }
18137
18138 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
18139         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res_constr;
18140         _res_constr.datalen = _res->arr_len;
18141         if (_res_constr.datalen > 0)
18142                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
18143         else
18144                 _res_constr.data = NULL;
18145         uint64_t* _res_vals = _res->elems;
18146         for (size_t x = 0; x < _res_constr.datalen; x++) {
18147                 uint64_t _res_conv_49 = _res_vals[x];
18148                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18149                 CHECK_ACCESS(_res_conv_49_ptr);
18150                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_conv_49_ptr);
18151                 FREE(untag_ptr(_res_conv_49));
18152                 _res_constr.data[x] = _res_conv_49_conv;
18153         }
18154         FREE(_res);
18155         CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res_constr);
18156 }
18157
18158 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
18159         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
18160         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18161         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
18162         return tag_ptr(ret_conv, true);
18163 }
18164
18165 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
18166         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18167         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
18168         return tag_ptr(ret_conv, true);
18169 }
18170
18171 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
18172         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
18173         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
18174         return ret_conv;
18175 }
18176
18177 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
18178         if (!ptr_is_owned(_res)) return;
18179         void* _res_ptr = untag_ptr(_res);
18180         CHECK_ACCESS(_res_ptr);
18181         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
18182         FREE(untag_ptr(_res));
18183         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
18184 }
18185
18186 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
18187         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18188         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
18189         return tag_ptr(ret_conv, true);
18190 }
18191 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
18192         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
18193         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
18194         return ret_conv;
18195 }
18196
18197 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
18198         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
18199         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18200         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
18201         return tag_ptr(ret_conv, true);
18202 }
18203
18204 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
18205         LDKCVec_MonitorEventZ _res_constr;
18206         _res_constr.datalen = _res->arr_len;
18207         if (_res_constr.datalen > 0)
18208                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18209         else
18210                 _res_constr.data = NULL;
18211         uint64_t* _res_vals = _res->elems;
18212         for (size_t o = 0; o < _res_constr.datalen; o++) {
18213                 uint64_t _res_conv_14 = _res_vals[o];
18214                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
18215                 CHECK_ACCESS(_res_conv_14_ptr);
18216                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
18217                 FREE(untag_ptr(_res_conv_14));
18218                 _res_constr.data[o] = _res_conv_14_conv;
18219         }
18220         FREE(_res);
18221         CVec_MonitorEventZ_free(_res_constr);
18222 }
18223
18224 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
18225         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18226         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
18227         return tag_ptr(ret_conv, true);
18228 }
18229 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
18230         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
18231         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
18232         return ret_conv;
18233 }
18234
18235 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
18236         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
18237         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18238         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
18239         return tag_ptr(ret_conv, true);
18240 }
18241
18242 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
18243         LDKOutPoint a_conv;
18244         a_conv.inner = untag_ptr(a);
18245         a_conv.is_owned = ptr_is_owned(a);
18246         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18247         a_conv = OutPoint_clone(&a_conv);
18248         LDKCVec_MonitorEventZ b_constr;
18249         b_constr.datalen = b->arr_len;
18250         if (b_constr.datalen > 0)
18251                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18252         else
18253                 b_constr.data = NULL;
18254         uint64_t* b_vals = b->elems;
18255         for (size_t o = 0; o < b_constr.datalen; o++) {
18256                 uint64_t b_conv_14 = b_vals[o];
18257                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
18258                 CHECK_ACCESS(b_conv_14_ptr);
18259                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
18260                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
18261                 b_constr.data[o] = b_conv_14_conv;
18262         }
18263         FREE(b);
18264         LDKPublicKey c_ref;
18265         CHECK(c->arr_len == 33);
18266         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
18267         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18268         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
18269         return tag_ptr(ret_conv, true);
18270 }
18271
18272 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
18273         if (!ptr_is_owned(_res)) return;
18274         void* _res_ptr = untag_ptr(_res);
18275         CHECK_ACCESS(_res_ptr);
18276         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
18277         FREE(untag_ptr(_res));
18278         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
18279 }
18280
18281 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
18282         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
18283         _res_constr.datalen = _res->arr_len;
18284         if (_res_constr.datalen > 0)
18285                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
18286         else
18287                 _res_constr.data = NULL;
18288         uint64_t* _res_vals = _res->elems;
18289         for (size_t x = 0; x < _res_constr.datalen; x++) {
18290                 uint64_t _res_conv_49 = _res_vals[x];
18291                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18292                 CHECK_ACCESS(_res_conv_49_ptr);
18293                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
18294                 FREE(untag_ptr(_res_conv_49));
18295                 _res_constr.data[x] = _res_conv_49_conv;
18296         }
18297         FREE(_res);
18298         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
18299 }
18300
18301 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
18302         LDKInitFeatures o_conv;
18303         o_conv.inner = untag_ptr(o);
18304         o_conv.is_owned = ptr_is_owned(o);
18305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18306         o_conv = InitFeatures_clone(&o_conv);
18307         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18308         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
18309         return tag_ptr(ret_conv, true);
18310 }
18311
18312 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
18313         void* e_ptr = untag_ptr(e);
18314         CHECK_ACCESS(e_ptr);
18315         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18316         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18317         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18318         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
18319         return tag_ptr(ret_conv, true);
18320 }
18321
18322 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18323         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
18324         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
18325         return ret_conv;
18326 }
18327
18328 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
18329         if (!ptr_is_owned(_res)) return;
18330         void* _res_ptr = untag_ptr(_res);
18331         CHECK_ACCESS(_res_ptr);
18332         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
18333         FREE(untag_ptr(_res));
18334         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
18335 }
18336
18337 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18338         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18339         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
18340         return tag_ptr(ret_conv, true);
18341 }
18342 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18343         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
18344         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18345         return ret_conv;
18346 }
18347
18348 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
18349         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
18350         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18351         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
18352         return tag_ptr(ret_conv, true);
18353 }
18354
18355 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
18356         LDKChannelFeatures o_conv;
18357         o_conv.inner = untag_ptr(o);
18358         o_conv.is_owned = ptr_is_owned(o);
18359         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18360         o_conv = ChannelFeatures_clone(&o_conv);
18361         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18362         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
18363         return tag_ptr(ret_conv, true);
18364 }
18365
18366 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
18367         void* e_ptr = untag_ptr(e);
18368         CHECK_ACCESS(e_ptr);
18369         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18370         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18371         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18372         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
18373         return tag_ptr(ret_conv, true);
18374 }
18375
18376 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18377         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
18378         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
18379         return ret_conv;
18380 }
18381
18382 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
18383         if (!ptr_is_owned(_res)) return;
18384         void* _res_ptr = untag_ptr(_res);
18385         CHECK_ACCESS(_res_ptr);
18386         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
18387         FREE(untag_ptr(_res));
18388         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
18389 }
18390
18391 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18392         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18393         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
18394         return tag_ptr(ret_conv, true);
18395 }
18396 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18397         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
18398         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18399         return ret_conv;
18400 }
18401
18402 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
18403         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
18404         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18405         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
18406         return tag_ptr(ret_conv, true);
18407 }
18408
18409 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
18410         LDKNodeFeatures o_conv;
18411         o_conv.inner = untag_ptr(o);
18412         o_conv.is_owned = ptr_is_owned(o);
18413         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18414         o_conv = NodeFeatures_clone(&o_conv);
18415         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18416         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
18417         return tag_ptr(ret_conv, true);
18418 }
18419
18420 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
18421         void* e_ptr = untag_ptr(e);
18422         CHECK_ACCESS(e_ptr);
18423         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18424         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18425         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18426         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
18427         return tag_ptr(ret_conv, true);
18428 }
18429
18430 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18431         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
18432         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
18433         return ret_conv;
18434 }
18435
18436 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
18437         if (!ptr_is_owned(_res)) return;
18438         void* _res_ptr = untag_ptr(_res);
18439         CHECK_ACCESS(_res_ptr);
18440         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
18441         FREE(untag_ptr(_res));
18442         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
18443 }
18444
18445 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18446         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18447         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
18448         return tag_ptr(ret_conv, true);
18449 }
18450 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18451         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
18452         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18453         return ret_conv;
18454 }
18455
18456 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18457         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
18458         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18459         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
18460         return tag_ptr(ret_conv, true);
18461 }
18462
18463 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18464         LDKBolt11InvoiceFeatures o_conv;
18465         o_conv.inner = untag_ptr(o);
18466         o_conv.is_owned = ptr_is_owned(o);
18467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18468         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
18469         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18470         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18471         return tag_ptr(ret_conv, true);
18472 }
18473
18474 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18475         void* e_ptr = untag_ptr(e);
18476         CHECK_ACCESS(e_ptr);
18477         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18478         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18479         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18480         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
18481         return tag_ptr(ret_conv, true);
18482 }
18483
18484 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18485         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18486         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18487         return ret_conv;
18488 }
18489
18490 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18491         if (!ptr_is_owned(_res)) return;
18492         void* _res_ptr = untag_ptr(_res);
18493         CHECK_ACCESS(_res_ptr);
18494         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18495         FREE(untag_ptr(_res));
18496         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18497 }
18498
18499 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18500         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18501         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
18502         return tag_ptr(ret_conv, true);
18503 }
18504 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18505         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18506         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18507         return ret_conv;
18508 }
18509
18510 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18511         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18512         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18513         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18514         return tag_ptr(ret_conv, true);
18515 }
18516
18517 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18518         LDKBolt12InvoiceFeatures o_conv;
18519         o_conv.inner = untag_ptr(o);
18520         o_conv.is_owned = ptr_is_owned(o);
18521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18522         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
18523         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18524         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18525         return tag_ptr(ret_conv, true);
18526 }
18527
18528 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18529         void* e_ptr = untag_ptr(e);
18530         CHECK_ACCESS(e_ptr);
18531         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18532         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18533         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18534         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
18535         return tag_ptr(ret_conv, true);
18536 }
18537
18538 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18539         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18540         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18541         return ret_conv;
18542 }
18543
18544 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18545         if (!ptr_is_owned(_res)) return;
18546         void* _res_ptr = untag_ptr(_res);
18547         CHECK_ACCESS(_res_ptr);
18548         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18549         FREE(untag_ptr(_res));
18550         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18551 }
18552
18553 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18554         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18555         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
18556         return tag_ptr(ret_conv, true);
18557 }
18558 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18559         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18560         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18561         return ret_conv;
18562 }
18563
18564 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18565         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18566         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18567         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18568         return tag_ptr(ret_conv, true);
18569 }
18570
18571 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
18572         LDKBlindedHopFeatures o_conv;
18573         o_conv.inner = untag_ptr(o);
18574         o_conv.is_owned = ptr_is_owned(o);
18575         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18576         o_conv = BlindedHopFeatures_clone(&o_conv);
18577         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18578         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
18579         return tag_ptr(ret_conv, true);
18580 }
18581
18582 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
18583         void* e_ptr = untag_ptr(e);
18584         CHECK_ACCESS(e_ptr);
18585         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18586         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18587         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18588         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
18589         return tag_ptr(ret_conv, true);
18590 }
18591
18592 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18593         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
18594         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
18595         return ret_conv;
18596 }
18597
18598 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
18599         if (!ptr_is_owned(_res)) return;
18600         void* _res_ptr = untag_ptr(_res);
18601         CHECK_ACCESS(_res_ptr);
18602         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
18603         FREE(untag_ptr(_res));
18604         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
18605 }
18606
18607 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18608         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18609         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
18610         return tag_ptr(ret_conv, true);
18611 }
18612 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18613         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
18614         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18615         return ret_conv;
18616 }
18617
18618 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
18619         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
18620         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18621         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
18622         return tag_ptr(ret_conv, true);
18623 }
18624
18625 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
18626         LDKChannelTypeFeatures o_conv;
18627         o_conv.inner = untag_ptr(o);
18628         o_conv.is_owned = ptr_is_owned(o);
18629         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18630         o_conv = ChannelTypeFeatures_clone(&o_conv);
18631         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18632         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
18633         return tag_ptr(ret_conv, true);
18634 }
18635
18636 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
18637         void* e_ptr = untag_ptr(e);
18638         CHECK_ACCESS(e_ptr);
18639         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18640         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18641         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18642         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
18643         return tag_ptr(ret_conv, true);
18644 }
18645
18646 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18647         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
18648         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
18649         return ret_conv;
18650 }
18651
18652 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
18653         if (!ptr_is_owned(_res)) return;
18654         void* _res_ptr = untag_ptr(_res);
18655         CHECK_ACCESS(_res_ptr);
18656         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
18657         FREE(untag_ptr(_res));
18658         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
18659 }
18660
18661 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18662         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18663         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
18664         return tag_ptr(ret_conv, true);
18665 }
18666 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18667         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
18668         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18669         return ret_conv;
18670 }
18671
18672 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18673         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
18674         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18675         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
18676         return tag_ptr(ret_conv, true);
18677 }
18678
18679 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
18680         LDKOffer o_conv;
18681         o_conv.inner = untag_ptr(o);
18682         o_conv.is_owned = ptr_is_owned(o);
18683         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18684         o_conv = Offer_clone(&o_conv);
18685         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
18686         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
18687         return tag_ptr(ret_conv, true);
18688 }
18689
18690 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
18691         LDKBolt12ParseError e_conv;
18692         e_conv.inner = untag_ptr(e);
18693         e_conv.is_owned = ptr_is_owned(e);
18694         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18695         e_conv = Bolt12ParseError_clone(&e_conv);
18696         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
18697         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
18698         return tag_ptr(ret_conv, true);
18699 }
18700
18701 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
18702         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
18703         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
18704         return ret_conv;
18705 }
18706
18707 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
18708         if (!ptr_is_owned(_res)) return;
18709         void* _res_ptr = untag_ptr(_res);
18710         CHECK_ACCESS(_res_ptr);
18711         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
18712         FREE(untag_ptr(_res));
18713         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
18714 }
18715
18716 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
18717         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
18718         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
18719         return tag_ptr(ret_conv, true);
18720 }
18721 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
18722         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
18723         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
18724         return ret_conv;
18725 }
18726
18727 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
18728         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
18729         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
18730         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
18731         return tag_ptr(ret_conv, true);
18732 }
18733
18734 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
18735         LDKPublicKey o_ref;
18736         CHECK(o->arr_len == 33);
18737         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
18738         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
18739         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
18740         return tag_ptr(ret_conv, true);
18741 }
18742
18743 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
18744         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
18745         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
18746         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
18747         return tag_ptr(ret_conv, true);
18748 }
18749
18750 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
18751         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
18752         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
18753         return ret_conv;
18754 }
18755
18756 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
18757         if (!ptr_is_owned(_res)) return;
18758         void* _res_ptr = untag_ptr(_res);
18759         CHECK_ACCESS(_res_ptr);
18760         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
18761         FREE(untag_ptr(_res));
18762         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
18763 }
18764
18765 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
18766         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
18767         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
18768         return tag_ptr(ret_conv, true);
18769 }
18770 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
18771         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
18772         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
18773         return ret_conv;
18774 }
18775
18776 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
18777         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
18778         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
18779         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
18780         return tag_ptr(ret_conv, true);
18781 }
18782
18783 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
18784         LDKNodeId o_conv;
18785         o_conv.inner = untag_ptr(o);
18786         o_conv.is_owned = ptr_is_owned(o);
18787         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18788         o_conv = NodeId_clone(&o_conv);
18789         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18790         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
18791         return tag_ptr(ret_conv, true);
18792 }
18793
18794 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
18795         void* e_ptr = untag_ptr(e);
18796         CHECK_ACCESS(e_ptr);
18797         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18798         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18799         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18800         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
18801         return tag_ptr(ret_conv, true);
18802 }
18803
18804 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
18805         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
18806         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
18807         return ret_conv;
18808 }
18809
18810 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
18811         if (!ptr_is_owned(_res)) return;
18812         void* _res_ptr = untag_ptr(_res);
18813         CHECK_ACCESS(_res_ptr);
18814         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
18815         FREE(untag_ptr(_res));
18816         CResult_NodeIdDecodeErrorZ_free(_res_conv);
18817 }
18818
18819 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
18820         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18821         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
18822         return tag_ptr(ret_conv, true);
18823 }
18824 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
18825         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
18826         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
18827         return ret_conv;
18828 }
18829
18830 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
18831         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
18832         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18833         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
18834         return tag_ptr(ret_conv, true);
18835 }
18836
18837 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
18838         void* o_ptr = untag_ptr(o);
18839         CHECK_ACCESS(o_ptr);
18840         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
18841         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
18842         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18843         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
18844         uint64_t ret_ref = tag_ptr(ret_copy, true);
18845         return ret_ref;
18846 }
18847
18848 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
18849         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18850         *ret_copy = COption_NetworkUpdateZ_none();
18851         uint64_t ret_ref = tag_ptr(ret_copy, true);
18852         return ret_ref;
18853 }
18854
18855 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
18856         if (!ptr_is_owned(_res)) return;
18857         void* _res_ptr = untag_ptr(_res);
18858         CHECK_ACCESS(_res_ptr);
18859         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
18860         FREE(untag_ptr(_res));
18861         COption_NetworkUpdateZ_free(_res_conv);
18862 }
18863
18864 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
18865         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18866         *ret_copy = COption_NetworkUpdateZ_clone(arg);
18867         uint64_t ret_ref = tag_ptr(ret_copy, true);
18868         return ret_ref;
18869 }
18870 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
18871         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
18872         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
18873         return ret_conv;
18874 }
18875
18876 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
18877         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
18878         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18879         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
18880         uint64_t ret_ref = tag_ptr(ret_copy, true);
18881         return ret_ref;
18882 }
18883
18884 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
18885         void* o_ptr = untag_ptr(o);
18886         CHECK_ACCESS(o_ptr);
18887         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
18888         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
18889         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18890         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
18891         return tag_ptr(ret_conv, true);
18892 }
18893
18894 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
18895         void* e_ptr = untag_ptr(e);
18896         CHECK_ACCESS(e_ptr);
18897         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18898         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18899         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18900         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
18901         return tag_ptr(ret_conv, true);
18902 }
18903
18904 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
18905         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
18906         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
18907         return ret_conv;
18908 }
18909
18910 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
18911         if (!ptr_is_owned(_res)) return;
18912         void* _res_ptr = untag_ptr(_res);
18913         CHECK_ACCESS(_res_ptr);
18914         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
18915         FREE(untag_ptr(_res));
18916         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
18917 }
18918
18919 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
18920         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18921         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
18922         return tag_ptr(ret_conv, true);
18923 }
18924 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
18925         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
18926         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
18927         return ret_conv;
18928 }
18929
18930 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
18931         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
18932         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18933         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
18934         return tag_ptr(ret_conv, true);
18935 }
18936
18937 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
18938         void* o_ptr = untag_ptr(o);
18939         CHECK_ACCESS(o_ptr);
18940         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
18941         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
18942                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18943                 LDKUtxoLookup_JCalls_cloned(&o_conv);
18944         }
18945         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
18946         *ret_copy = COption_UtxoLookupZ_some(o_conv);
18947         uint64_t ret_ref = tag_ptr(ret_copy, true);
18948         return ret_ref;
18949 }
18950
18951 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
18952         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
18953         *ret_copy = COption_UtxoLookupZ_none();
18954         uint64_t ret_ref = tag_ptr(ret_copy, true);
18955         return ret_ref;
18956 }
18957
18958 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
18959         if (!ptr_is_owned(_res)) return;
18960         void* _res_ptr = untag_ptr(_res);
18961         CHECK_ACCESS(_res_ptr);
18962         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
18963         FREE(untag_ptr(_res));
18964         COption_UtxoLookupZ_free(_res_conv);
18965 }
18966
18967 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
18968         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18969         *ret_conv = CResult_NoneLightningErrorZ_ok();
18970         return tag_ptr(ret_conv, true);
18971 }
18972
18973 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
18974         LDKLightningError e_conv;
18975         e_conv.inner = untag_ptr(e);
18976         e_conv.is_owned = ptr_is_owned(e);
18977         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18978         e_conv = LightningError_clone(&e_conv);
18979         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18980         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
18981         return tag_ptr(ret_conv, true);
18982 }
18983
18984 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
18985         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
18986         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
18987         return ret_conv;
18988 }
18989
18990 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
18991         if (!ptr_is_owned(_res)) return;
18992         void* _res_ptr = untag_ptr(_res);
18993         CHECK_ACCESS(_res_ptr);
18994         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
18995         FREE(untag_ptr(_res));
18996         CResult_NoneLightningErrorZ_free(_res_conv);
18997 }
18998
18999 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19000         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19001         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19002         return tag_ptr(ret_conv, true);
19003 }
19004 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
19005         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
19006         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19007         return ret_conv;
19008 }
19009
19010 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
19011         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
19012         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19013         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19014         return tag_ptr(ret_conv, true);
19015 }
19016
19017 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
19018         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19019         *ret_conv = CResult_boolLightningErrorZ_ok(o);
19020         return tag_ptr(ret_conv, true);
19021 }
19022
19023 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
19024         LDKLightningError e_conv;
19025         e_conv.inner = untag_ptr(e);
19026         e_conv.is_owned = ptr_is_owned(e);
19027         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19028         e_conv = LightningError_clone(&e_conv);
19029         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19030         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19031         return tag_ptr(ret_conv, true);
19032 }
19033
19034 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
19035         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
19036         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
19037         return ret_conv;
19038 }
19039
19040 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
19041         if (!ptr_is_owned(_res)) return;
19042         void* _res_ptr = untag_ptr(_res);
19043         CHECK_ACCESS(_res_ptr);
19044         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19045         FREE(untag_ptr(_res));
19046         CResult_boolLightningErrorZ_free(_res_conv);
19047 }
19048
19049 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19050         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19051         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19052         return tag_ptr(ret_conv, true);
19053 }
19054 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
19055         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
19056         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19057         return ret_conv;
19058 }
19059
19060 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
19061         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
19062         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19063         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19064         return tag_ptr(ret_conv, true);
19065 }
19066
19067 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19068         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19069         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19070         return tag_ptr(ret_conv, true);
19071 }
19072 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
19073         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
19074         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19075         return ret_conv;
19076 }
19077
19078 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
19079         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
19080         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19081         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19082         return tag_ptr(ret_conv, true);
19083 }
19084
19085 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
19086         LDKChannelAnnouncement a_conv;
19087         a_conv.inner = untag_ptr(a);
19088         a_conv.is_owned = ptr_is_owned(a);
19089         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19090         a_conv = ChannelAnnouncement_clone(&a_conv);
19091         LDKChannelUpdate b_conv;
19092         b_conv.inner = untag_ptr(b);
19093         b_conv.is_owned = ptr_is_owned(b);
19094         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19095         b_conv = ChannelUpdate_clone(&b_conv);
19096         LDKChannelUpdate c_conv;
19097         c_conv.inner = untag_ptr(c);
19098         c_conv.is_owned = ptr_is_owned(c);
19099         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19100         c_conv = ChannelUpdate_clone(&c_conv);
19101         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19102         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19103         return tag_ptr(ret_conv, true);
19104 }
19105
19106 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
19107         if (!ptr_is_owned(_res)) return;
19108         void* _res_ptr = untag_ptr(_res);
19109         CHECK_ACCESS(_res_ptr);
19110         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19111         FREE(untag_ptr(_res));
19112         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19113 }
19114
19115 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
19116         void* o_ptr = untag_ptr(o);
19117         CHECK_ACCESS(o_ptr);
19118         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
19119         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
19120         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19121         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
19122         uint64_t ret_ref = tag_ptr(ret_copy, true);
19123         return ret_ref;
19124 }
19125
19126 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
19127         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19128         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
19129         uint64_t ret_ref = tag_ptr(ret_copy, true);
19130         return ret_ref;
19131 }
19132
19133 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
19134         if (!ptr_is_owned(_res)) return;
19135         void* _res_ptr = untag_ptr(_res);
19136         CHECK_ACCESS(_res_ptr);
19137         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
19138         FREE(untag_ptr(_res));
19139         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
19140 }
19141
19142 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
19143         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19144         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
19145         uint64_t ret_ref = tag_ptr(ret_copy, true);
19146         return ret_ref;
19147 }
19148 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
19149         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
19150         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
19151         return ret_conv;
19152 }
19153
19154 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
19155         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
19156         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19157         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
19158         uint64_t ret_ref = tag_ptr(ret_copy, true);
19159         return ret_ref;
19160 }
19161
19162 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
19163         LDKCVec_MessageSendEventZ _res_constr;
19164         _res_constr.datalen = _res->arr_len;
19165         if (_res_constr.datalen > 0)
19166                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
19167         else
19168                 _res_constr.data = NULL;
19169         uint64_t* _res_vals = _res->elems;
19170         for (size_t s = 0; s < _res_constr.datalen; s++) {
19171                 uint64_t _res_conv_18 = _res_vals[s];
19172                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
19173                 CHECK_ACCESS(_res_conv_18_ptr);
19174                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
19175                 FREE(untag_ptr(_res_conv_18));
19176                 _res_constr.data[s] = _res_conv_18_conv;
19177         }
19178         FREE(_res);
19179         CVec_MessageSendEventZ_free(_res_constr);
19180 }
19181
19182 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
19183         LDKChannelUpdateInfo o_conv;
19184         o_conv.inner = untag_ptr(o);
19185         o_conv.is_owned = ptr_is_owned(o);
19186         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19187         o_conv = ChannelUpdateInfo_clone(&o_conv);
19188         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19189         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
19190         return tag_ptr(ret_conv, true);
19191 }
19192
19193 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
19194         void* e_ptr = untag_ptr(e);
19195         CHECK_ACCESS(e_ptr);
19196         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19197         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19198         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19199         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
19200         return tag_ptr(ret_conv, true);
19201 }
19202
19203 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
19204         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
19205         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
19206         return ret_conv;
19207 }
19208
19209 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
19210         if (!ptr_is_owned(_res)) return;
19211         void* _res_ptr = untag_ptr(_res);
19212         CHECK_ACCESS(_res_ptr);
19213         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
19214         FREE(untag_ptr(_res));
19215         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
19216 }
19217
19218 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
19219         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19220         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
19221         return tag_ptr(ret_conv, true);
19222 }
19223 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19224         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
19225         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
19226         return ret_conv;
19227 }
19228
19229 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
19230         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
19231         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19232         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
19233         return tag_ptr(ret_conv, true);
19234 }
19235
19236 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
19237         LDKChannelInfo o_conv;
19238         o_conv.inner = untag_ptr(o);
19239         o_conv.is_owned = ptr_is_owned(o);
19240         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19241         o_conv = ChannelInfo_clone(&o_conv);
19242         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19243         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
19244         return tag_ptr(ret_conv, true);
19245 }
19246
19247 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
19248         void* e_ptr = untag_ptr(e);
19249         CHECK_ACCESS(e_ptr);
19250         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19251         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19252         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19253         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
19254         return tag_ptr(ret_conv, true);
19255 }
19256
19257 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
19258         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
19259         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
19260         return ret_conv;
19261 }
19262
19263 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
19264         if (!ptr_is_owned(_res)) return;
19265         void* _res_ptr = untag_ptr(_res);
19266         CHECK_ACCESS(_res_ptr);
19267         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
19268         FREE(untag_ptr(_res));
19269         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
19270 }
19271
19272 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19273         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19274         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
19275         return tag_ptr(ret_conv, true);
19276 }
19277 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19278         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
19279         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19280         return ret_conv;
19281 }
19282
19283 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
19284         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
19285         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19286         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
19287         return tag_ptr(ret_conv, true);
19288 }
19289
19290 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
19291         LDKRoutingFees o_conv;
19292         o_conv.inner = untag_ptr(o);
19293         o_conv.is_owned = ptr_is_owned(o);
19294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19295         o_conv = RoutingFees_clone(&o_conv);
19296         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19297         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
19298         return tag_ptr(ret_conv, true);
19299 }
19300
19301 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
19302         void* e_ptr = untag_ptr(e);
19303         CHECK_ACCESS(e_ptr);
19304         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19305         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19306         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19307         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
19308         return tag_ptr(ret_conv, true);
19309 }
19310
19311 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
19312         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
19313         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
19314         return ret_conv;
19315 }
19316
19317 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
19318         if (!ptr_is_owned(_res)) return;
19319         void* _res_ptr = untag_ptr(_res);
19320         CHECK_ACCESS(_res_ptr);
19321         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
19322         FREE(untag_ptr(_res));
19323         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
19324 }
19325
19326 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
19327         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19328         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
19329         return tag_ptr(ret_conv, true);
19330 }
19331 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
19332         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
19333         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
19334         return ret_conv;
19335 }
19336
19337 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
19338         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
19339         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19340         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
19341         return tag_ptr(ret_conv, true);
19342 }
19343
19344 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
19345         LDKCVec_SocketAddressZ _res_constr;
19346         _res_constr.datalen = _res->arr_len;
19347         if (_res_constr.datalen > 0)
19348                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
19349         else
19350                 _res_constr.data = NULL;
19351         uint64_t* _res_vals = _res->elems;
19352         for (size_t p = 0; p < _res_constr.datalen; p++) {
19353                 uint64_t _res_conv_15 = _res_vals[p];
19354                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
19355                 CHECK_ACCESS(_res_conv_15_ptr);
19356                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
19357                 FREE(untag_ptr(_res_conv_15));
19358                 _res_constr.data[p] = _res_conv_15_conv;
19359         }
19360         FREE(_res);
19361         CVec_SocketAddressZ_free(_res_constr);
19362 }
19363
19364 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
19365         LDKNodeAnnouncementInfo o_conv;
19366         o_conv.inner = untag_ptr(o);
19367         o_conv.is_owned = ptr_is_owned(o);
19368         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19369         o_conv = NodeAnnouncementInfo_clone(&o_conv);
19370         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19371         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
19372         return tag_ptr(ret_conv, true);
19373 }
19374
19375 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
19376         void* e_ptr = untag_ptr(e);
19377         CHECK_ACCESS(e_ptr);
19378         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19379         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19380         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19381         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
19382         return tag_ptr(ret_conv, true);
19383 }
19384
19385 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
19386         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
19387         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
19388         return ret_conv;
19389 }
19390
19391 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
19392         if (!ptr_is_owned(_res)) return;
19393         void* _res_ptr = untag_ptr(_res);
19394         CHECK_ACCESS(_res_ptr);
19395         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
19396         FREE(untag_ptr(_res));
19397         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
19398 }
19399
19400 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
19401         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19402         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
19403         return tag_ptr(ret_conv, true);
19404 }
19405 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19406         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
19407         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
19408         return ret_conv;
19409 }
19410
19411 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
19412         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
19413         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19414         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
19415         return tag_ptr(ret_conv, true);
19416 }
19417
19418 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
19419         LDKNodeAlias o_conv;
19420         o_conv.inner = untag_ptr(o);
19421         o_conv.is_owned = ptr_is_owned(o);
19422         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19423         o_conv = NodeAlias_clone(&o_conv);
19424         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19425         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
19426         return tag_ptr(ret_conv, true);
19427 }
19428
19429 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
19430         void* e_ptr = untag_ptr(e);
19431         CHECK_ACCESS(e_ptr);
19432         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19433         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19434         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19435         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
19436         return tag_ptr(ret_conv, true);
19437 }
19438
19439 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
19440         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
19441         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
19442         return ret_conv;
19443 }
19444
19445 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
19446         if (!ptr_is_owned(_res)) return;
19447         void* _res_ptr = untag_ptr(_res);
19448         CHECK_ACCESS(_res_ptr);
19449         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
19450         FREE(untag_ptr(_res));
19451         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
19452 }
19453
19454 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
19455         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19456         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
19457         return tag_ptr(ret_conv, true);
19458 }
19459 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
19460         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
19461         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
19462         return ret_conv;
19463 }
19464
19465 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
19466         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
19467         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19468         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
19469         return tag_ptr(ret_conv, true);
19470 }
19471
19472 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
19473         LDKNodeInfo o_conv;
19474         o_conv.inner = untag_ptr(o);
19475         o_conv.is_owned = ptr_is_owned(o);
19476         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19477         o_conv = NodeInfo_clone(&o_conv);
19478         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19479         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
19480         return tag_ptr(ret_conv, true);
19481 }
19482
19483 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
19484         void* e_ptr = untag_ptr(e);
19485         CHECK_ACCESS(e_ptr);
19486         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19487         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19488         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19489         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
19490         return tag_ptr(ret_conv, true);
19491 }
19492
19493 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
19494         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
19495         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
19496         return ret_conv;
19497 }
19498
19499 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
19500         if (!ptr_is_owned(_res)) return;
19501         void* _res_ptr = untag_ptr(_res);
19502         CHECK_ACCESS(_res_ptr);
19503         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
19504         FREE(untag_ptr(_res));
19505         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
19506 }
19507
19508 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
19509         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19510         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
19511         return tag_ptr(ret_conv, true);
19512 }
19513 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19514         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
19515         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
19516         return ret_conv;
19517 }
19518
19519 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
19520         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
19521         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19522         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
19523         return tag_ptr(ret_conv, true);
19524 }
19525
19526 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
19527         LDKNetworkGraph o_conv;
19528         o_conv.inner = untag_ptr(o);
19529         o_conv.is_owned = ptr_is_owned(o);
19530         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19531         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
19532         
19533         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19534         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
19535         return tag_ptr(ret_conv, true);
19536 }
19537
19538 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
19539         void* e_ptr = untag_ptr(e);
19540         CHECK_ACCESS(e_ptr);
19541         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19542         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19543         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19544         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
19545         return tag_ptr(ret_conv, true);
19546 }
19547
19548 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
19549         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
19550         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
19551         return ret_conv;
19552 }
19553
19554 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
19555         if (!ptr_is_owned(_res)) return;
19556         void* _res_ptr = untag_ptr(_res);
19557         CHECK_ACCESS(_res_ptr);
19558         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
19559         FREE(untag_ptr(_res));
19560         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
19561 }
19562
19563 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
19564         LDKCVec_SocketAddressZ o_constr;
19565         o_constr.datalen = o->arr_len;
19566         if (o_constr.datalen > 0)
19567                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
19568         else
19569                 o_constr.data = NULL;
19570         uint64_t* o_vals = o->elems;
19571         for (size_t p = 0; p < o_constr.datalen; p++) {
19572                 uint64_t o_conv_15 = o_vals[p];
19573                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
19574                 CHECK_ACCESS(o_conv_15_ptr);
19575                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
19576                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
19577                 o_constr.data[p] = o_conv_15_conv;
19578         }
19579         FREE(o);
19580         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19581         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
19582         uint64_t ret_ref = tag_ptr(ret_copy, true);
19583         return ret_ref;
19584 }
19585
19586 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
19587         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19588         *ret_copy = COption_CVec_SocketAddressZZ_none();
19589         uint64_t ret_ref = tag_ptr(ret_copy, true);
19590         return ret_ref;
19591 }
19592
19593 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
19594         if (!ptr_is_owned(_res)) return;
19595         void* _res_ptr = untag_ptr(_res);
19596         CHECK_ACCESS(_res_ptr);
19597         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
19598         FREE(untag_ptr(_res));
19599         COption_CVec_SocketAddressZZ_free(_res_conv);
19600 }
19601
19602 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
19603         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19604         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
19605         uint64_t ret_ref = tag_ptr(ret_copy, true);
19606         return ret_ref;
19607 }
19608 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
19609         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
19610         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
19611         return ret_conv;
19612 }
19613
19614 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
19615         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
19616         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19617         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
19618         uint64_t ret_ref = tag_ptr(ret_copy, true);
19619         return ret_ref;
19620 }
19621
19622 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
19623         LDKChannelDerivationParameters o_conv;
19624         o_conv.inner = untag_ptr(o);
19625         o_conv.is_owned = ptr_is_owned(o);
19626         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19627         o_conv = ChannelDerivationParameters_clone(&o_conv);
19628         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19629         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
19630         return tag_ptr(ret_conv, true);
19631 }
19632
19633 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
19634         void* e_ptr = untag_ptr(e);
19635         CHECK_ACCESS(e_ptr);
19636         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19637         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19638         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19639         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
19640         return tag_ptr(ret_conv, true);
19641 }
19642
19643 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
19644         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
19645         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
19646         return ret_conv;
19647 }
19648
19649 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
19650         if (!ptr_is_owned(_res)) return;
19651         void* _res_ptr = untag_ptr(_res);
19652         CHECK_ACCESS(_res_ptr);
19653         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
19654         FREE(untag_ptr(_res));
19655         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
19656 }
19657
19658 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
19659         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19660         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
19661         return tag_ptr(ret_conv, true);
19662 }
19663 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19664         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
19665         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
19666         return ret_conv;
19667 }
19668
19669 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
19670         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
19671         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19672         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
19673         return tag_ptr(ret_conv, true);
19674 }
19675
19676 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
19677         LDKHTLCDescriptor o_conv;
19678         o_conv.inner = untag_ptr(o);
19679         o_conv.is_owned = ptr_is_owned(o);
19680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19681         o_conv = HTLCDescriptor_clone(&o_conv);
19682         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19683         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
19684         return tag_ptr(ret_conv, true);
19685 }
19686
19687 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
19688         void* e_ptr = untag_ptr(e);
19689         CHECK_ACCESS(e_ptr);
19690         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19691         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19692         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19693         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
19694         return tag_ptr(ret_conv, true);
19695 }
19696
19697 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19698         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
19699         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
19700         return ret_conv;
19701 }
19702
19703 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
19704         if (!ptr_is_owned(_res)) return;
19705         void* _res_ptr = untag_ptr(_res);
19706         CHECK_ACCESS(_res_ptr);
19707         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
19708         FREE(untag_ptr(_res));
19709         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
19710 }
19711
19712 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19713         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19714         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
19715         return tag_ptr(ret_conv, true);
19716 }
19717 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19718         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
19719         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19720         return ret_conv;
19721 }
19722
19723 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
19724         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
19725         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19726         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
19727         return tag_ptr(ret_conv, true);
19728 }
19729
19730 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
19731         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
19732         _res_constr.datalen = _res->arr_len;
19733         if (_res_constr.datalen > 0)
19734                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
19735         else
19736                 _res_constr.data = NULL;
19737         uint64_t* _res_vals = _res->elems;
19738         for (size_t y = 0; y < _res_constr.datalen; y++) {
19739                 uint64_t _res_conv_24 = _res_vals[y];
19740                 LDKHTLCOutputInCommitment _res_conv_24_conv;
19741                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
19742                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
19743                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
19744                 _res_constr.data[y] = _res_conv_24_conv;
19745         }
19746         FREE(_res);
19747         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
19748 }
19749
19750 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
19751         LDKCVec_HTLCDescriptorZ _res_constr;
19752         _res_constr.datalen = _res->arr_len;
19753         if (_res_constr.datalen > 0)
19754                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
19755         else
19756                 _res_constr.data = NULL;
19757         uint64_t* _res_vals = _res->elems;
19758         for (size_t q = 0; q < _res_constr.datalen; q++) {
19759                 uint64_t _res_conv_16 = _res_vals[q];
19760                 LDKHTLCDescriptor _res_conv_16_conv;
19761                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19762                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19763                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19764                 _res_constr.data[q] = _res_conv_16_conv;
19765         }
19766         FREE(_res);
19767         CVec_HTLCDescriptorZ_free(_res_constr);
19768 }
19769
19770 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
19771         LDKCVec_UtxoZ _res_constr;
19772         _res_constr.datalen = _res->arr_len;
19773         if (_res_constr.datalen > 0)
19774                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
19775         else
19776                 _res_constr.data = NULL;
19777         uint64_t* _res_vals = _res->elems;
19778         for (size_t g = 0; g < _res_constr.datalen; g++) {
19779                 uint64_t _res_conv_6 = _res_vals[g];
19780                 LDKUtxo _res_conv_6_conv;
19781                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
19782                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
19783                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
19784                 _res_constr.data[g] = _res_conv_6_conv;
19785         }
19786         FREE(_res);
19787         CVec_UtxoZ_free(_res_constr);
19788 }
19789
19790 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
19791         void* o_ptr = untag_ptr(o);
19792         CHECK_ACCESS(o_ptr);
19793         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
19794         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
19795         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
19796         *ret_copy = COption_TxOutZ_some(o_conv);
19797         uint64_t ret_ref = tag_ptr(ret_copy, true);
19798         return ret_ref;
19799 }
19800
19801 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
19802         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
19803         *ret_copy = COption_TxOutZ_none();
19804         uint64_t ret_ref = tag_ptr(ret_copy, true);
19805         return ret_ref;
19806 }
19807
19808 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
19809         if (!ptr_is_owned(_res)) return;
19810         void* _res_ptr = untag_ptr(_res);
19811         CHECK_ACCESS(_res_ptr);
19812         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
19813         FREE(untag_ptr(_res));
19814         COption_TxOutZ_free(_res_conv);
19815 }
19816
19817 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
19818         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
19819         *ret_copy = COption_TxOutZ_clone(arg);
19820         uint64_t ret_ref = tag_ptr(ret_copy, true);
19821         return ret_ref;
19822 }
19823 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
19824         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
19825         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
19826         return ret_conv;
19827 }
19828
19829 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
19830         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
19831         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
19832         *ret_copy = COption_TxOutZ_clone(orig_conv);
19833         uint64_t ret_ref = tag_ptr(ret_copy, true);
19834         return ret_ref;
19835 }
19836
19837 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
19838         LDKCVec_InputZ _res_constr;
19839         _res_constr.datalen = _res->arr_len;
19840         if (_res_constr.datalen > 0)
19841                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
19842         else
19843                 _res_constr.data = NULL;
19844         uint64_t* _res_vals = _res->elems;
19845         for (size_t h = 0; h < _res_constr.datalen; h++) {
19846                 uint64_t _res_conv_7 = _res_vals[h];
19847                 LDKInput _res_conv_7_conv;
19848                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
19849                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
19850                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
19851                 _res_constr.data[h] = _res_conv_7_conv;
19852         }
19853         FREE(_res);
19854         CVec_InputZ_free(_res_constr);
19855 }
19856
19857 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
19858         LDKCoinSelection o_conv;
19859         o_conv.inner = untag_ptr(o);
19860         o_conv.is_owned = ptr_is_owned(o);
19861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19862         o_conv = CoinSelection_clone(&o_conv);
19863         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
19864         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
19865         return tag_ptr(ret_conv, true);
19866 }
19867
19868 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
19869         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
19870         *ret_conv = CResult_CoinSelectionNoneZ_err();
19871         return tag_ptr(ret_conv, true);
19872 }
19873
19874 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
19875         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
19876         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
19877         return ret_conv;
19878 }
19879
19880 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
19881         if (!ptr_is_owned(_res)) return;
19882         void* _res_ptr = untag_ptr(_res);
19883         CHECK_ACCESS(_res_ptr);
19884         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
19885         FREE(untag_ptr(_res));
19886         CResult_CoinSelectionNoneZ_free(_res_conv);
19887 }
19888
19889 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
19890         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
19891         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
19892         return tag_ptr(ret_conv, true);
19893 }
19894 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
19895         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
19896         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
19897         return ret_conv;
19898 }
19899
19900 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
19901         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
19902         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
19903         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
19904         return tag_ptr(ret_conv, true);
19905 }
19906
19907 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
19908         LDKCVec_UtxoZ o_constr;
19909         o_constr.datalen = o->arr_len;
19910         if (o_constr.datalen > 0)
19911                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
19912         else
19913                 o_constr.data = NULL;
19914         uint64_t* o_vals = o->elems;
19915         for (size_t g = 0; g < o_constr.datalen; g++) {
19916                 uint64_t o_conv_6 = o_vals[g];
19917                 LDKUtxo o_conv_6_conv;
19918                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
19919                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
19920                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
19921                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
19922                 o_constr.data[g] = o_conv_6_conv;
19923         }
19924         FREE(o);
19925         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19926         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
19927         return tag_ptr(ret_conv, true);
19928 }
19929
19930 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
19931         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19932         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
19933         return tag_ptr(ret_conv, true);
19934 }
19935
19936 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
19937         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
19938         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
19939         return ret_conv;
19940 }
19941
19942 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
19943         if (!ptr_is_owned(_res)) return;
19944         void* _res_ptr = untag_ptr(_res);
19945         CHECK_ACCESS(_res_ptr);
19946         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
19947         FREE(untag_ptr(_res));
19948         CResult_CVec_UtxoZNoneZ_free(_res_conv);
19949 }
19950
19951 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
19952         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19953         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
19954         return tag_ptr(ret_conv, true);
19955 }
19956 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
19957         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
19958         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
19959         return ret_conv;
19960 }
19961
19962 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
19963         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
19964         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19965         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
19966         return tag_ptr(ret_conv, true);
19967 }
19968
19969 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
19970         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
19971         *ret_conv = C2Tuple_u64u16Z_clone(arg);
19972         return tag_ptr(ret_conv, true);
19973 }
19974 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
19975         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
19976         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
19977         return ret_conv;
19978 }
19979
19980 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
19981         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
19982         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
19983         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
19984         return tag_ptr(ret_conv, true);
19985 }
19986
19987 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
19988         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
19989         *ret_conv = C2Tuple_u64u16Z_new(a, b);
19990         return tag_ptr(ret_conv, true);
19991 }
19992
19993 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
19994         if (!ptr_is_owned(_res)) return;
19995         void* _res_ptr = untag_ptr(_res);
19996         CHECK_ACCESS(_res_ptr);
19997         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
19998         FREE(untag_ptr(_res));
19999         C2Tuple_u64u16Z_free(_res_conv);
20000 }
20001
20002 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
20003         void* o_ptr = untag_ptr(o);
20004         CHECK_ACCESS(o_ptr);
20005         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
20006         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
20007         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20008         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
20009         uint64_t ret_ref = tag_ptr(ret_copy, true);
20010         return ret_ref;
20011 }
20012
20013 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
20014         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20015         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
20016         uint64_t ret_ref = tag_ptr(ret_copy, true);
20017         return ret_ref;
20018 }
20019
20020 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
20021         if (!ptr_is_owned(_res)) return;
20022         void* _res_ptr = untag_ptr(_res);
20023         CHECK_ACCESS(_res_ptr);
20024         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
20025         FREE(untag_ptr(_res));
20026         COption_C2Tuple_u64u16ZZ_free(_res_conv);
20027 }
20028
20029 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
20030         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20031         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
20032         uint64_t ret_ref = tag_ptr(ret_copy, true);
20033         return ret_ref;
20034 }
20035 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
20036         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
20037         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
20038         return ret_conv;
20039 }
20040
20041 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
20042         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
20043         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20044         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
20045         uint64_t ret_ref = tag_ptr(ret_copy, true);
20046         return ret_ref;
20047 }
20048
20049 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
20050         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
20051         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20052         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
20053         uint64_t ret_ref = tag_ptr(ret_copy, true);
20054         return ret_ref;
20055 }
20056
20057 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
20058         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20059         *ret_copy = COption_ChannelShutdownStateZ_none();
20060         uint64_t ret_ref = tag_ptr(ret_copy, true);
20061         return ret_ref;
20062 }
20063
20064 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
20065         if (!ptr_is_owned(_res)) return;
20066         void* _res_ptr = untag_ptr(_res);
20067         CHECK_ACCESS(_res_ptr);
20068         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
20069         FREE(untag_ptr(_res));
20070         COption_ChannelShutdownStateZ_free(_res_conv);
20071 }
20072
20073 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
20074         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20075         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
20076         uint64_t ret_ref = tag_ptr(ret_copy, true);
20077         return ret_ref;
20078 }
20079 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
20080         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
20081         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
20082         return ret_conv;
20083 }
20084
20085 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
20086         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
20087         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20088         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
20089         uint64_t ret_ref = tag_ptr(ret_copy, true);
20090         return ret_ref;
20091 }
20092
20093 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
20094         LDKThirtyTwoBytes o_ref;
20095         CHECK(o->arr_len == 32);
20096         memcpy(o_ref.data, o->elems, 32); FREE(o);
20097         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20098         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
20099         return tag_ptr(ret_conv, true);
20100 }
20101
20102 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
20103         void* e_ptr = untag_ptr(e);
20104         CHECK_ACCESS(e_ptr);
20105         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20106         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20107         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20108         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
20109         return tag_ptr(ret_conv, true);
20110 }
20111
20112 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
20113         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
20114         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
20115         return ret_conv;
20116 }
20117
20118 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
20119         if (!ptr_is_owned(_res)) return;
20120         void* _res_ptr = untag_ptr(_res);
20121         CHECK_ACCESS(_res_ptr);
20122         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
20123         FREE(untag_ptr(_res));
20124         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
20125 }
20126
20127 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
20128         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20129         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
20130         return tag_ptr(ret_conv, true);
20131 }
20132 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
20133         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
20134         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
20135         return ret_conv;
20136 }
20137
20138 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
20139         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
20140         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20141         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
20142         return tag_ptr(ret_conv, true);
20143 }
20144
20145 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
20146         LDKCVec_RecentPaymentDetailsZ _res_constr;
20147         _res_constr.datalen = _res->arr_len;
20148         if (_res_constr.datalen > 0)
20149                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
20150         else
20151                 _res_constr.data = NULL;
20152         uint64_t* _res_vals = _res->elems;
20153         for (size_t w = 0; w < _res_constr.datalen; w++) {
20154                 uint64_t _res_conv_22 = _res_vals[w];
20155                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20156                 CHECK_ACCESS(_res_conv_22_ptr);
20157                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
20158                 FREE(untag_ptr(_res_conv_22));
20159                 _res_constr.data[w] = _res_conv_22_conv;
20160         }
20161         FREE(_res);
20162         CVec_RecentPaymentDetailsZ_free(_res_constr);
20163 }
20164
20165 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
20166         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20167         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
20168         return tag_ptr(ret_conv, true);
20169 }
20170
20171 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
20172         void* e_ptr = untag_ptr(e);
20173         CHECK_ACCESS(e_ptr);
20174         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20175         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20176         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20177         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
20178         return tag_ptr(ret_conv, true);
20179 }
20180
20181 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
20182         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
20183         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
20184         return ret_conv;
20185 }
20186
20187 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
20188         if (!ptr_is_owned(_res)) return;
20189         void* _res_ptr = untag_ptr(_res);
20190         CHECK_ACCESS(_res_ptr);
20191         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
20192         FREE(untag_ptr(_res));
20193         CResult_NonePaymentSendFailureZ_free(_res_conv);
20194 }
20195
20196 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
20197         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20198         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
20199         return tag_ptr(ret_conv, true);
20200 }
20201 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
20202         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
20203         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
20204         return ret_conv;
20205 }
20206
20207 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
20208         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
20209         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20210         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
20211         return tag_ptr(ret_conv, true);
20212 }
20213
20214 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
20215         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20216         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
20217         return tag_ptr(ret_conv, true);
20218 }
20219
20220 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
20221         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20222         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20223         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
20224         return tag_ptr(ret_conv, true);
20225 }
20226
20227 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
20228         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
20229         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
20230         return ret_conv;
20231 }
20232
20233 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
20234         if (!ptr_is_owned(_res)) return;
20235         void* _res_ptr = untag_ptr(_res);
20236         CHECK_ACCESS(_res_ptr);
20237         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
20238         FREE(untag_ptr(_res));
20239         CResult_NoneRetryableSendFailureZ_free(_res_conv);
20240 }
20241
20242 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
20243         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20244         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
20245         return tag_ptr(ret_conv, true);
20246 }
20247 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20248         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
20249         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
20250         return ret_conv;
20251 }
20252
20253 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
20254         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
20255         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20256         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
20257         return tag_ptr(ret_conv, true);
20258 }
20259
20260 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
20261         LDKThirtyTwoBytes o_ref;
20262         CHECK(o->arr_len == 32);
20263         memcpy(o_ref.data, o->elems, 32); FREE(o);
20264         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20265         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
20266         return tag_ptr(ret_conv, true);
20267 }
20268
20269 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
20270         void* e_ptr = untag_ptr(e);
20271         CHECK_ACCESS(e_ptr);
20272         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20273         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20274         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20275         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
20276         return tag_ptr(ret_conv, true);
20277 }
20278
20279 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
20280         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
20281         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
20282         return ret_conv;
20283 }
20284
20285 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
20286         if (!ptr_is_owned(_res)) return;
20287         void* _res_ptr = untag_ptr(_res);
20288         CHECK_ACCESS(_res_ptr);
20289         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
20290         FREE(untag_ptr(_res));
20291         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
20292 }
20293
20294 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
20295         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20296         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
20297         return tag_ptr(ret_conv, true);
20298 }
20299 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20300         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
20301         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
20302         return ret_conv;
20303 }
20304
20305 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
20306         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
20307         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20308         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
20309         return tag_ptr(ret_conv, true);
20310 }
20311
20312 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
20313         LDKThirtyTwoBytes o_ref;
20314         CHECK(o->arr_len == 32);
20315         memcpy(o_ref.data, o->elems, 32); FREE(o);
20316         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20317         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
20318         return tag_ptr(ret_conv, true);
20319 }
20320
20321 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
20322         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20323         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20324         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
20325         return tag_ptr(ret_conv, true);
20326 }
20327
20328 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
20329         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
20330         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
20331         return ret_conv;
20332 }
20333
20334 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
20335         if (!ptr_is_owned(_res)) return;
20336         void* _res_ptr = untag_ptr(_res);
20337         CHECK_ACCESS(_res_ptr);
20338         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
20339         FREE(untag_ptr(_res));
20340         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
20341 }
20342
20343 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
20344         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20345         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
20346         return tag_ptr(ret_conv, true);
20347 }
20348 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20349         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
20350         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
20351         return ret_conv;
20352 }
20353
20354 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
20355         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
20356         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20357         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
20358         return tag_ptr(ret_conv, true);
20359 }
20360
20361 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
20362         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20363         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
20364         return tag_ptr(ret_conv, true);
20365 }
20366 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
20367         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
20368         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
20369         return ret_conv;
20370 }
20371
20372 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
20373         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
20374         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20375         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
20376         return tag_ptr(ret_conv, true);
20377 }
20378
20379 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
20380         LDKThirtyTwoBytes a_ref;
20381         CHECK(a->arr_len == 32);
20382         memcpy(a_ref.data, a->elems, 32); FREE(a);
20383         LDKThirtyTwoBytes b_ref;
20384         CHECK(b->arr_len == 32);
20385         memcpy(b_ref.data, b->elems, 32); FREE(b);
20386         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20387         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
20388         return tag_ptr(ret_conv, true);
20389 }
20390
20391 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
20392         if (!ptr_is_owned(_res)) return;
20393         void* _res_ptr = untag_ptr(_res);
20394         CHECK_ACCESS(_res_ptr);
20395         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
20396         FREE(untag_ptr(_res));
20397         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
20398 }
20399
20400 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
20401         void* o_ptr = untag_ptr(o);
20402         CHECK_ACCESS(o_ptr);
20403         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
20404         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
20405         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20406         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
20407         return tag_ptr(ret_conv, true);
20408 }
20409
20410 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
20411         void* e_ptr = untag_ptr(e);
20412         CHECK_ACCESS(e_ptr);
20413         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20414         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20415         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20416         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
20417         return tag_ptr(ret_conv, true);
20418 }
20419
20420 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
20421         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
20422         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
20423         return ret_conv;
20424 }
20425
20426 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
20427         if (!ptr_is_owned(_res)) return;
20428         void* _res_ptr = untag_ptr(_res);
20429         CHECK_ACCESS(_res_ptr);
20430         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
20431         FREE(untag_ptr(_res));
20432         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
20433 }
20434
20435 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
20436         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20437         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
20438         return tag_ptr(ret_conv, true);
20439 }
20440 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20441         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
20442         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
20443         return ret_conv;
20444 }
20445
20446 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
20447         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
20448         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20449         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
20450         return tag_ptr(ret_conv, true);
20451 }
20452
20453 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
20454         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
20455         _res_constr.datalen = _res->arr_len;
20456         if (_res_constr.datalen > 0)
20457                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
20458         else
20459                 _res_constr.data = NULL;
20460         uint64_t* _res_vals = _res->elems;
20461         for (size_t o = 0; o < _res_constr.datalen; o++) {
20462                 uint64_t _res_conv_40 = _res_vals[o];
20463                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
20464                 CHECK_ACCESS(_res_conv_40_ptr);
20465                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
20466                 FREE(untag_ptr(_res_conv_40));
20467                 _res_constr.data[o] = _res_conv_40_conv;
20468         }
20469         FREE(_res);
20470         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
20471 }
20472
20473 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
20474         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
20475         o_constr.datalen = o->arr_len;
20476         if (o_constr.datalen > 0)
20477                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
20478         else
20479                 o_constr.data = NULL;
20480         uint64_t* o_vals = o->elems;
20481         for (size_t o = 0; o < o_constr.datalen; o++) {
20482                 uint64_t o_conv_40 = o_vals[o];
20483                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
20484                 CHECK_ACCESS(o_conv_40_ptr);
20485                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
20486                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
20487                 o_constr.data[o] = o_conv_40_conv;
20488         }
20489         FREE(o);
20490         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20491         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
20492         return tag_ptr(ret_conv, true);
20493 }
20494
20495 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
20496         void* e_ptr = untag_ptr(e);
20497         CHECK_ACCESS(e_ptr);
20498         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
20499         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
20500         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20501         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
20502         return tag_ptr(ret_conv, true);
20503 }
20504
20505 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
20506         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
20507         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
20508         return ret_conv;
20509 }
20510
20511 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(uint64_t _res) {
20512         if (!ptr_is_owned(_res)) return;
20513         void* _res_ptr = untag_ptr(_res);
20514         CHECK_ACCESS(_res_ptr);
20515         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
20516         FREE(untag_ptr(_res));
20517         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
20518 }
20519
20520 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
20521         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20522         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
20523         return tag_ptr(ret_conv, true);
20524 }
20525 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
20526         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
20527         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
20528         return ret_conv;
20529 }
20530
20531 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
20532         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
20533         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20534         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
20535         return tag_ptr(ret_conv, true);
20536 }
20537
20538 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
20539         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20540         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
20541         return tag_ptr(ret_conv, true);
20542 }
20543 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(uint64_t arg) {
20544         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
20545         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
20546         return ret_conv;
20547 }
20548
20549 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(uint64_t orig) {
20550         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
20551         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20552         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
20553         return tag_ptr(ret_conv, true);
20554 }
20555
20556 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new(int8_tArray a, int8_tArray b) {
20557         LDKThirtyTwoBytes a_ref;
20558         CHECK(a->arr_len == 32);
20559         memcpy(a_ref.data, a->elems, 32); FREE(a);
20560         LDKPublicKey b_ref;
20561         CHECK(b->arr_len == 33);
20562         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
20563         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20564         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
20565         return tag_ptr(ret_conv, true);
20566 }
20567
20568 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free(uint64_t _res) {
20569         if (!ptr_is_owned(_res)) return;
20570         void* _res_ptr = untag_ptr(_res);
20571         CHECK_ACCESS(_res_ptr);
20572         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
20573         FREE(untag_ptr(_res));
20574         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
20575 }
20576
20577 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(uint64_tArray _res) {
20578         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
20579         _res_constr.datalen = _res->arr_len;
20580         if (_res_constr.datalen > 0)
20581                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
20582         else
20583                 _res_constr.data = NULL;
20584         uint64_t* _res_vals = _res->elems;
20585         for (size_t j = 0; j < _res_constr.datalen; j++) {
20586                 uint64_t _res_conv_35 = _res_vals[j];
20587                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
20588                 CHECK_ACCESS(_res_conv_35_ptr);
20589                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
20590                 FREE(untag_ptr(_res_conv_35));
20591                 _res_constr.data[j] = _res_conv_35_conv;
20592         }
20593         FREE(_res);
20594         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
20595 }
20596
20597 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
20598         void* o_ptr = untag_ptr(o);
20599         CHECK_ACCESS(o_ptr);
20600         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
20601         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
20602         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20603         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
20604         return tag_ptr(ret_conv, true);
20605 }
20606
20607 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
20608         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20609         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
20610         return tag_ptr(ret_conv, true);
20611 }
20612
20613 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
20614         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
20615         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
20616         return ret_conv;
20617 }
20618
20619 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
20620         if (!ptr_is_owned(_res)) return;
20621         void* _res_ptr = untag_ptr(_res);
20622         CHECK_ACCESS(_res_ptr);
20623         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
20624         FREE(untag_ptr(_res));
20625         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
20626 }
20627
20628 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
20629         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20630         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
20631         return tag_ptr(ret_conv, true);
20632 }
20633 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
20634         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
20635         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
20636         return ret_conv;
20637 }
20638
20639 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
20640         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
20641         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20642         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
20643         return tag_ptr(ret_conv, true);
20644 }
20645
20646 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
20647         LDKCounterpartyForwardingInfo o_conv;
20648         o_conv.inner = untag_ptr(o);
20649         o_conv.is_owned = ptr_is_owned(o);
20650         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20651         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
20652         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20653         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
20654         return tag_ptr(ret_conv, true);
20655 }
20656
20657 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
20658         void* e_ptr = untag_ptr(e);
20659         CHECK_ACCESS(e_ptr);
20660         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20661         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20662         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20663         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
20664         return tag_ptr(ret_conv, true);
20665 }
20666
20667 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
20668         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
20669         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
20670         return ret_conv;
20671 }
20672
20673 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
20674         if (!ptr_is_owned(_res)) return;
20675         void* _res_ptr = untag_ptr(_res);
20676         CHECK_ACCESS(_res_ptr);
20677         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
20678         FREE(untag_ptr(_res));
20679         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
20680 }
20681
20682 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
20683         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20684         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
20685         return tag_ptr(ret_conv, true);
20686 }
20687 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
20688         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
20689         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
20690         return ret_conv;
20691 }
20692
20693 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
20694         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
20695         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20696         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
20697         return tag_ptr(ret_conv, true);
20698 }
20699
20700 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
20701         LDKChannelCounterparty o_conv;
20702         o_conv.inner = untag_ptr(o);
20703         o_conv.is_owned = ptr_is_owned(o);
20704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20705         o_conv = ChannelCounterparty_clone(&o_conv);
20706         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20707         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
20708         return tag_ptr(ret_conv, true);
20709 }
20710
20711 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
20712         void* e_ptr = untag_ptr(e);
20713         CHECK_ACCESS(e_ptr);
20714         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20715         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20716         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20717         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
20718         return tag_ptr(ret_conv, true);
20719 }
20720
20721 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
20722         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
20723         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
20724         return ret_conv;
20725 }
20726
20727 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
20728         if (!ptr_is_owned(_res)) return;
20729         void* _res_ptr = untag_ptr(_res);
20730         CHECK_ACCESS(_res_ptr);
20731         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
20732         FREE(untag_ptr(_res));
20733         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
20734 }
20735
20736 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
20737         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20738         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
20739         return tag_ptr(ret_conv, true);
20740 }
20741 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
20742         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
20743         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
20744         return ret_conv;
20745 }
20746
20747 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
20748         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
20749         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20750         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
20751         return tag_ptr(ret_conv, true);
20752 }
20753
20754 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
20755         LDKChannelDetails o_conv;
20756         o_conv.inner = untag_ptr(o);
20757         o_conv.is_owned = ptr_is_owned(o);
20758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20759         o_conv = ChannelDetails_clone(&o_conv);
20760         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20761         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
20762         return tag_ptr(ret_conv, true);
20763 }
20764
20765 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
20766         void* e_ptr = untag_ptr(e);
20767         CHECK_ACCESS(e_ptr);
20768         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20769         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20770         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20771         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
20772         return tag_ptr(ret_conv, true);
20773 }
20774
20775 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
20776         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
20777         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
20778         return ret_conv;
20779 }
20780
20781 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
20782         if (!ptr_is_owned(_res)) return;
20783         void* _res_ptr = untag_ptr(_res);
20784         CHECK_ACCESS(_res_ptr);
20785         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
20786         FREE(untag_ptr(_res));
20787         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
20788 }
20789
20790 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
20791         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20792         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
20793         return tag_ptr(ret_conv, true);
20794 }
20795 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
20796         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
20797         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
20798         return ret_conv;
20799 }
20800
20801 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
20802         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
20803         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20804         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
20805         return tag_ptr(ret_conv, true);
20806 }
20807
20808 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
20809         LDKPhantomRouteHints o_conv;
20810         o_conv.inner = untag_ptr(o);
20811         o_conv.is_owned = ptr_is_owned(o);
20812         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20813         o_conv = PhantomRouteHints_clone(&o_conv);
20814         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20815         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
20816         return tag_ptr(ret_conv, true);
20817 }
20818
20819 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
20820         void* e_ptr = untag_ptr(e);
20821         CHECK_ACCESS(e_ptr);
20822         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20823         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20824         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20825         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
20826         return tag_ptr(ret_conv, true);
20827 }
20828
20829 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
20830         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
20831         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
20832         return ret_conv;
20833 }
20834
20835 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
20836         if (!ptr_is_owned(_res)) return;
20837         void* _res_ptr = untag_ptr(_res);
20838         CHECK_ACCESS(_res_ptr);
20839         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
20840         FREE(untag_ptr(_res));
20841         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
20842 }
20843
20844 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
20845         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20846         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
20847         return tag_ptr(ret_conv, true);
20848 }
20849 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
20850         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
20851         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
20852         return ret_conv;
20853 }
20854
20855 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
20856         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
20857         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20858         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
20859         return tag_ptr(ret_conv, true);
20860 }
20861
20862 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
20863         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
20864         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
20865         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
20866         return tag_ptr(ret_conv, true);
20867 }
20868
20869 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
20870         void* e_ptr = untag_ptr(e);
20871         CHECK_ACCESS(e_ptr);
20872         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20873         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20874         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
20875         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
20876         return tag_ptr(ret_conv, true);
20877 }
20878
20879 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
20880         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
20881         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
20882         return ret_conv;
20883 }
20884
20885 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
20886         if (!ptr_is_owned(_res)) return;
20887         void* _res_ptr = untag_ptr(_res);
20888         CHECK_ACCESS(_res_ptr);
20889         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
20890         FREE(untag_ptr(_res));
20891         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
20892 }
20893
20894 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
20895         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
20896         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
20897         return tag_ptr(ret_conv, true);
20898 }
20899 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
20900         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
20901         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
20902         return ret_conv;
20903 }
20904
20905 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
20906         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
20907         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
20908         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
20909         return tag_ptr(ret_conv, true);
20910 }
20911
20912 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
20913         LDKCVec_ChannelMonitorZ _res_constr;
20914         _res_constr.datalen = _res->arr_len;
20915         if (_res_constr.datalen > 0)
20916                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
20917         else
20918                 _res_constr.data = NULL;
20919         uint64_t* _res_vals = _res->elems;
20920         for (size_t q = 0; q < _res_constr.datalen; q++) {
20921                 uint64_t _res_conv_16 = _res_vals[q];
20922                 LDKChannelMonitor _res_conv_16_conv;
20923                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20924                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20925                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20926                 _res_constr.data[q] = _res_conv_16_conv;
20927         }
20928         FREE(_res);
20929         CVec_ChannelMonitorZ_free(_res_constr);
20930 }
20931
20932 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
20933         LDKThirtyTwoBytes a_ref;
20934         CHECK(a->arr_len == 32);
20935         memcpy(a_ref.data, a->elems, 32); FREE(a);
20936         LDKChannelManager b_conv;
20937         b_conv.inner = untag_ptr(b);
20938         b_conv.is_owned = ptr_is_owned(b);
20939         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20940         // WARNING: we need a move here but no clone is available for LDKChannelManager
20941         
20942         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
20943         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
20944         return tag_ptr(ret_conv, true);
20945 }
20946
20947 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
20948         if (!ptr_is_owned(_res)) return;
20949         void* _res_ptr = untag_ptr(_res);
20950         CHECK_ACCESS(_res_ptr);
20951         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
20952         FREE(untag_ptr(_res));
20953         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
20954 }
20955
20956 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
20957         void* o_ptr = untag_ptr(o);
20958         CHECK_ACCESS(o_ptr);
20959         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
20960         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
20961         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
20962         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
20963         return tag_ptr(ret_conv, true);
20964 }
20965
20966 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
20967         void* e_ptr = untag_ptr(e);
20968         CHECK_ACCESS(e_ptr);
20969         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20970         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20971         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
20972         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
20973         return tag_ptr(ret_conv, true);
20974 }
20975
20976 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
20977         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
20978         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
20979         return ret_conv;
20980 }
20981
20982 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
20983         if (!ptr_is_owned(_res)) return;
20984         void* _res_ptr = untag_ptr(_res);
20985         CHECK_ACCESS(_res_ptr);
20986         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
20987         FREE(untag_ptr(_res));
20988         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
20989 }
20990
20991 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
20992         void* o_ptr = untag_ptr(o);
20993         CHECK_ACCESS(o_ptr);
20994         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
20995         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
20996         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
20997         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
20998         return tag_ptr(ret_conv, true);
20999 }
21000
21001 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
21002         void* e_ptr = untag_ptr(e);
21003         CHECK_ACCESS(e_ptr);
21004         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21005         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21006         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21007         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
21008         return tag_ptr(ret_conv, true);
21009 }
21010
21011 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
21012         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
21013         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
21014         return ret_conv;
21015 }
21016
21017 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
21018         if (!ptr_is_owned(_res)) return;
21019         void* _res_ptr = untag_ptr(_res);
21020         CHECK_ACCESS(_res_ptr);
21021         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
21022         FREE(untag_ptr(_res));
21023         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
21024 }
21025
21026 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
21027         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21028         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
21029         return tag_ptr(ret_conv, true);
21030 }
21031 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
21032         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
21033         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
21034         return ret_conv;
21035 }
21036
21037 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
21038         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
21039         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21040         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
21041         return tag_ptr(ret_conv, true);
21042 }
21043
21044 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
21045         LDKChannelConfig o_conv;
21046         o_conv.inner = untag_ptr(o);
21047         o_conv.is_owned = ptr_is_owned(o);
21048         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21049         o_conv = ChannelConfig_clone(&o_conv);
21050         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21051         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
21052         return tag_ptr(ret_conv, true);
21053 }
21054
21055 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
21056         void* e_ptr = untag_ptr(e);
21057         CHECK_ACCESS(e_ptr);
21058         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21059         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21060         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21061         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
21062         return tag_ptr(ret_conv, true);
21063 }
21064
21065 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
21066         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
21067         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
21068         return ret_conv;
21069 }
21070
21071 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
21072         if (!ptr_is_owned(_res)) return;
21073         void* _res_ptr = untag_ptr(_res);
21074         CHECK_ACCESS(_res_ptr);
21075         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
21076         FREE(untag_ptr(_res));
21077         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
21078 }
21079
21080 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
21081         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21082         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
21083         return tag_ptr(ret_conv, true);
21084 }
21085 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
21086         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
21087         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
21088         return ret_conv;
21089 }
21090
21091 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
21092         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
21093         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21094         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
21095         return tag_ptr(ret_conv, true);
21096 }
21097
21098 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
21099         void* o_ptr = untag_ptr(o);
21100         CHECK_ACCESS(o_ptr);
21101         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21102         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21103         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21104         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
21105         uint64_t ret_ref = tag_ptr(ret_copy, true);
21106         return ret_ref;
21107 }
21108
21109 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
21110         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21111         *ret_copy = COption_MaxDustHTLCExposureZ_none();
21112         uint64_t ret_ref = tag_ptr(ret_copy, true);
21113         return ret_ref;
21114 }
21115
21116 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
21117         if (!ptr_is_owned(_res)) return;
21118         void* _res_ptr = untag_ptr(_res);
21119         CHECK_ACCESS(_res_ptr);
21120         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
21121         FREE(untag_ptr(_res));
21122         COption_MaxDustHTLCExposureZ_free(_res_conv);
21123 }
21124
21125 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
21126         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21127         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
21128         uint64_t ret_ref = tag_ptr(ret_copy, true);
21129         return ret_ref;
21130 }
21131 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
21132         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
21133         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
21134         return ret_conv;
21135 }
21136
21137 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
21138         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
21139         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21140         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
21141         uint64_t ret_ref = tag_ptr(ret_copy, true);
21142         return ret_ref;
21143 }
21144
21145 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
21146         void* o_ptr = untag_ptr(o);
21147         CHECK_ACCESS(o_ptr);
21148         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
21149         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
21150         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21151         *ret_copy = COption_APIErrorZ_some(o_conv);
21152         uint64_t ret_ref = tag_ptr(ret_copy, true);
21153         return ret_ref;
21154 }
21155
21156 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
21157         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21158         *ret_copy = COption_APIErrorZ_none();
21159         uint64_t ret_ref = tag_ptr(ret_copy, true);
21160         return ret_ref;
21161 }
21162
21163 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
21164         if (!ptr_is_owned(_res)) return;
21165         void* _res_ptr = untag_ptr(_res);
21166         CHECK_ACCESS(_res_ptr);
21167         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
21168         FREE(untag_ptr(_res));
21169         COption_APIErrorZ_free(_res_conv);
21170 }
21171
21172 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
21173         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21174         *ret_copy = COption_APIErrorZ_clone(arg);
21175         uint64_t ret_ref = tag_ptr(ret_copy, true);
21176         return ret_ref;
21177 }
21178 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
21179         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
21180         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
21181         return ret_conv;
21182 }
21183
21184 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
21185         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
21186         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21187         *ret_copy = COption_APIErrorZ_clone(orig_conv);
21188         uint64_t ret_ref = tag_ptr(ret_copy, true);
21189         return ret_ref;
21190 }
21191
21192 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
21193         void* o_ptr = untag_ptr(o);
21194         CHECK_ACCESS(o_ptr);
21195         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
21196         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
21197         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21198         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
21199         return tag_ptr(ret_conv, true);
21200 }
21201
21202 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
21203         void* e_ptr = untag_ptr(e);
21204         CHECK_ACCESS(e_ptr);
21205         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21206         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21207         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21208         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
21209         return tag_ptr(ret_conv, true);
21210 }
21211
21212 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
21213         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
21214         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
21215         return ret_conv;
21216 }
21217
21218 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
21219         if (!ptr_is_owned(_res)) return;
21220         void* _res_ptr = untag_ptr(_res);
21221         CHECK_ACCESS(_res_ptr);
21222         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
21223         FREE(untag_ptr(_res));
21224         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
21225 }
21226
21227 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
21228         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21229         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
21230         return tag_ptr(ret_conv, true);
21231 }
21232 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
21233         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
21234         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
21235         return ret_conv;
21236 }
21237
21238 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
21239         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
21240         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21241         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
21242         return tag_ptr(ret_conv, true);
21243 }
21244
21245 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
21246         LDKChannelMonitorUpdate o_conv;
21247         o_conv.inner = untag_ptr(o);
21248         o_conv.is_owned = ptr_is_owned(o);
21249         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21250         o_conv = ChannelMonitorUpdate_clone(&o_conv);
21251         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21252         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
21253         return tag_ptr(ret_conv, true);
21254 }
21255
21256 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
21257         void* e_ptr = untag_ptr(e);
21258         CHECK_ACCESS(e_ptr);
21259         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21260         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21261         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21262         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
21263         return tag_ptr(ret_conv, true);
21264 }
21265
21266 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
21267         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
21268         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
21269         return ret_conv;
21270 }
21271
21272 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
21273         if (!ptr_is_owned(_res)) return;
21274         void* _res_ptr = untag_ptr(_res);
21275         CHECK_ACCESS(_res_ptr);
21276         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
21277         FREE(untag_ptr(_res));
21278         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
21279 }
21280
21281 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
21282         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21283         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
21284         return tag_ptr(ret_conv, true);
21285 }
21286 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21287         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
21288         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
21289         return ret_conv;
21290 }
21291
21292 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
21293         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
21294         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21295         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
21296         return tag_ptr(ret_conv, true);
21297 }
21298
21299 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
21300         void* o_ptr = untag_ptr(o);
21301         CHECK_ACCESS(o_ptr);
21302         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
21303         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
21304         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21305         *ret_copy = COption_MonitorEventZ_some(o_conv);
21306         uint64_t ret_ref = tag_ptr(ret_copy, true);
21307         return ret_ref;
21308 }
21309
21310 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
21311         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21312         *ret_copy = COption_MonitorEventZ_none();
21313         uint64_t ret_ref = tag_ptr(ret_copy, true);
21314         return ret_ref;
21315 }
21316
21317 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
21318         if (!ptr_is_owned(_res)) return;
21319         void* _res_ptr = untag_ptr(_res);
21320         CHECK_ACCESS(_res_ptr);
21321         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
21322         FREE(untag_ptr(_res));
21323         COption_MonitorEventZ_free(_res_conv);
21324 }
21325
21326 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
21327         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21328         *ret_copy = COption_MonitorEventZ_clone(arg);
21329         uint64_t ret_ref = tag_ptr(ret_copy, true);
21330         return ret_ref;
21331 }
21332 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
21333         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
21334         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
21335         return ret_conv;
21336 }
21337
21338 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
21339         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
21340         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21341         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
21342         uint64_t ret_ref = tag_ptr(ret_copy, true);
21343         return ret_ref;
21344 }
21345
21346 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
21347         void* o_ptr = untag_ptr(o);
21348         CHECK_ACCESS(o_ptr);
21349         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
21350         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
21351         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21352         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
21353         return tag_ptr(ret_conv, true);
21354 }
21355
21356 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
21357         void* e_ptr = untag_ptr(e);
21358         CHECK_ACCESS(e_ptr);
21359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21361         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21362         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
21363         return tag_ptr(ret_conv, true);
21364 }
21365
21366 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
21367         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
21368         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
21369         return ret_conv;
21370 }
21371
21372 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
21373         if (!ptr_is_owned(_res)) return;
21374         void* _res_ptr = untag_ptr(_res);
21375         CHECK_ACCESS(_res_ptr);
21376         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
21377         FREE(untag_ptr(_res));
21378         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
21379 }
21380
21381 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
21382         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21383         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
21384         return tag_ptr(ret_conv, true);
21385 }
21386 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
21387         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
21388         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
21389         return ret_conv;
21390 }
21391
21392 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
21393         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
21394         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21395         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
21396         return tag_ptr(ret_conv, true);
21397 }
21398
21399 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
21400         LDKHTLCUpdate o_conv;
21401         o_conv.inner = untag_ptr(o);
21402         o_conv.is_owned = ptr_is_owned(o);
21403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21404         o_conv = HTLCUpdate_clone(&o_conv);
21405         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21406         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
21407         return tag_ptr(ret_conv, true);
21408 }
21409
21410 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
21411         void* e_ptr = untag_ptr(e);
21412         CHECK_ACCESS(e_ptr);
21413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21415         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21416         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
21417         return tag_ptr(ret_conv, true);
21418 }
21419
21420 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
21421         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
21422         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
21423         return ret_conv;
21424 }
21425
21426 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
21427         if (!ptr_is_owned(_res)) return;
21428         void* _res_ptr = untag_ptr(_res);
21429         CHECK_ACCESS(_res_ptr);
21430         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
21431         FREE(untag_ptr(_res));
21432         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
21433 }
21434
21435 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
21436         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21437         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
21438         return tag_ptr(ret_conv, true);
21439 }
21440 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21441         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
21442         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
21443         return ret_conv;
21444 }
21445
21446 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
21447         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
21448         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21449         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
21450         return tag_ptr(ret_conv, true);
21451 }
21452
21453 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
21454         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21455         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
21456         return tag_ptr(ret_conv, true);
21457 }
21458 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
21459         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
21460         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
21461         return ret_conv;
21462 }
21463
21464 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
21465         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
21466         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21467         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
21468         return tag_ptr(ret_conv, true);
21469 }
21470
21471 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
21472         LDKOutPoint a_conv;
21473         a_conv.inner = untag_ptr(a);
21474         a_conv.is_owned = ptr_is_owned(a);
21475         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21476         a_conv = OutPoint_clone(&a_conv);
21477         LDKCVec_u8Z b_ref;
21478         b_ref.datalen = b->arr_len;
21479         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21480         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21481         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21482         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
21483         return tag_ptr(ret_conv, true);
21484 }
21485
21486 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
21487         if (!ptr_is_owned(_res)) return;
21488         void* _res_ptr = untag_ptr(_res);
21489         CHECK_ACCESS(_res_ptr);
21490         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
21491         FREE(untag_ptr(_res));
21492         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
21493 }
21494
21495 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
21496         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21497         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
21498         return tag_ptr(ret_conv, true);
21499 }
21500 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
21501         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
21502         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
21503         return ret_conv;
21504 }
21505
21506 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
21507         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
21508         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21509         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
21510         return tag_ptr(ret_conv, true);
21511 }
21512
21513 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
21514         LDKCVec_u8Z b_ref;
21515         b_ref.datalen = b->arr_len;
21516         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21517         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21518         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21519         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
21520         return tag_ptr(ret_conv, true);
21521 }
21522
21523 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
21524         if (!ptr_is_owned(_res)) return;
21525         void* _res_ptr = untag_ptr(_res);
21526         CHECK_ACCESS(_res_ptr);
21527         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
21528         FREE(untag_ptr(_res));
21529         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
21530 }
21531
21532 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
21533         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
21534         _res_constr.datalen = _res->arr_len;
21535         if (_res_constr.datalen > 0)
21536                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
21537         else
21538                 _res_constr.data = NULL;
21539         uint64_t* _res_vals = _res->elems;
21540         for (size_t x = 0; x < _res_constr.datalen; x++) {
21541                 uint64_t _res_conv_23 = _res_vals[x];
21542                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
21543                 CHECK_ACCESS(_res_conv_23_ptr);
21544                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
21545                 FREE(untag_ptr(_res_conv_23));
21546                 _res_constr.data[x] = _res_conv_23_conv;
21547         }
21548         FREE(_res);
21549         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
21550 }
21551
21552 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
21553         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
21554         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
21555         return tag_ptr(ret_conv, true);
21556 }
21557 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
21558         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
21559         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
21560         return ret_conv;
21561 }
21562
21563 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
21564         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
21565         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
21566         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
21567         return tag_ptr(ret_conv, true);
21568 }
21569
21570 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(int8_tArray a, uint64_tArray b) {
21571         LDKThirtyTwoBytes a_ref;
21572         CHECK(a->arr_len == 32);
21573         memcpy(a_ref.data, a->elems, 32); FREE(a);
21574         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
21575         b_constr.datalen = b->arr_len;
21576         if (b_constr.datalen > 0)
21577                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
21578         else
21579                 b_constr.data = NULL;
21580         uint64_t* b_vals = b->elems;
21581         for (size_t x = 0; x < b_constr.datalen; x++) {
21582                 uint64_t b_conv_23 = b_vals[x];
21583                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
21584                 CHECK_ACCESS(b_conv_23_ptr);
21585                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
21586                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
21587                 b_constr.data[x] = b_conv_23_conv;
21588         }
21589         FREE(b);
21590         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
21591         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
21592         return tag_ptr(ret_conv, true);
21593 }
21594
21595 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
21596         if (!ptr_is_owned(_res)) return;
21597         void* _res_ptr = untag_ptr(_res);
21598         CHECK_ACCESS(_res_ptr);
21599         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
21600         FREE(untag_ptr(_res));
21601         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
21602 }
21603
21604 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
21605         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
21606         _res_constr.datalen = _res->arr_len;
21607         if (_res_constr.datalen > 0)
21608                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
21609         else
21610                 _res_constr.data = NULL;
21611         uint64_t* _res_vals = _res->elems;
21612         for (size_t a = 0; a < _res_constr.datalen; a++) {
21613                 uint64_t _res_conv_52 = _res_vals[a];
21614                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
21615                 CHECK_ACCESS(_res_conv_52_ptr);
21616                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
21617                 FREE(untag_ptr(_res_conv_52));
21618                 _res_constr.data[a] = _res_conv_52_conv;
21619         }
21620         FREE(_res);
21621         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
21622 }
21623
21624 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
21625         LDKCVec_CommitmentTransactionZ _res_constr;
21626         _res_constr.datalen = _res->arr_len;
21627         if (_res_constr.datalen > 0)
21628                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
21629         else
21630                 _res_constr.data = NULL;
21631         uint64_t* _res_vals = _res->elems;
21632         for (size_t x = 0; x < _res_constr.datalen; x++) {
21633                 uint64_t _res_conv_23 = _res_vals[x];
21634                 LDKCommitmentTransaction _res_conv_23_conv;
21635                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
21636                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
21637                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
21638                 _res_constr.data[x] = _res_conv_23_conv;
21639         }
21640         FREE(_res);
21641         CVec_CommitmentTransactionZ_free(_res_constr);
21642 }
21643
21644 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
21645         LDKCVec_TransactionZ _res_constr;
21646         _res_constr.datalen = _res->arr_len;
21647         if (_res_constr.datalen > 0)
21648                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
21649         else
21650                 _res_constr.data = NULL;
21651         int8_tArray* _res_vals = (void*) _res->elems;
21652         for (size_t m = 0; m < _res_constr.datalen; m++) {
21653                 int8_tArray _res_conv_12 = _res_vals[m];
21654                 LDKTransaction _res_conv_12_ref;
21655                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
21656                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
21657                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
21658                 _res_conv_12_ref.data_is_owned = true;
21659                 _res_constr.data[m] = _res_conv_12_ref;
21660         }
21661         FREE(_res);
21662         CVec_TransactionZ_free(_res_constr);
21663 }
21664
21665 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
21666         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21667         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
21668         return tag_ptr(ret_conv, true);
21669 }
21670 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
21671         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
21672         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
21673         return ret_conv;
21674 }
21675
21676 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
21677         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
21678         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21679         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
21680         return tag_ptr(ret_conv, true);
21681 }
21682
21683 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
21684         void* b_ptr = untag_ptr(b);
21685         CHECK_ACCESS(b_ptr);
21686         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
21687         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
21688         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21689         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
21690         return tag_ptr(ret_conv, true);
21691 }
21692
21693 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
21694         if (!ptr_is_owned(_res)) return;
21695         void* _res_ptr = untag_ptr(_res);
21696         CHECK_ACCESS(_res_ptr);
21697         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
21698         FREE(untag_ptr(_res));
21699         C2Tuple_u32TxOutZ_free(_res_conv);
21700 }
21701
21702 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
21703         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
21704         _res_constr.datalen = _res->arr_len;
21705         if (_res_constr.datalen > 0)
21706                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21707         else
21708                 _res_constr.data = NULL;
21709         uint64_t* _res_vals = _res->elems;
21710         for (size_t u = 0; u < _res_constr.datalen; u++) {
21711                 uint64_t _res_conv_20 = _res_vals[u];
21712                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
21713                 CHECK_ACCESS(_res_conv_20_ptr);
21714                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
21715                 FREE(untag_ptr(_res_conv_20));
21716                 _res_constr.data[u] = _res_conv_20_conv;
21717         }
21718         FREE(_res);
21719         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
21720 }
21721
21722 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
21723         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
21724         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
21725         return tag_ptr(ret_conv, true);
21726 }
21727 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
21728         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
21729         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
21730         return ret_conv;
21731 }
21732
21733 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
21734         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
21735         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
21736         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
21737         return tag_ptr(ret_conv, true);
21738 }
21739
21740 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
21741         LDKThirtyTwoBytes a_ref;
21742         CHECK(a->arr_len == 32);
21743         memcpy(a_ref.data, a->elems, 32); FREE(a);
21744         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
21745         b_constr.datalen = b->arr_len;
21746         if (b_constr.datalen > 0)
21747                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21748         else
21749                 b_constr.data = NULL;
21750         uint64_t* b_vals = b->elems;
21751         for (size_t u = 0; u < b_constr.datalen; u++) {
21752                 uint64_t b_conv_20 = b_vals[u];
21753                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
21754                 CHECK_ACCESS(b_conv_20_ptr);
21755                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
21756                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
21757                 b_constr.data[u] = b_conv_20_conv;
21758         }
21759         FREE(b);
21760         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
21761         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
21762         return tag_ptr(ret_conv, true);
21763 }
21764
21765 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
21766         if (!ptr_is_owned(_res)) return;
21767         void* _res_ptr = untag_ptr(_res);
21768         CHECK_ACCESS(_res_ptr);
21769         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
21770         FREE(untag_ptr(_res));
21771         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
21772 }
21773
21774 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
21775         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
21776         _res_constr.datalen = _res->arr_len;
21777         if (_res_constr.datalen > 0)
21778                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
21779         else
21780                 _res_constr.data = NULL;
21781         uint64_t* _res_vals = _res->elems;
21782         for (size_t x = 0; x < _res_constr.datalen; x++) {
21783                 uint64_t _res_conv_49 = _res_vals[x];
21784                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
21785                 CHECK_ACCESS(_res_conv_49_ptr);
21786                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
21787                 FREE(untag_ptr(_res_conv_49));
21788                 _res_constr.data[x] = _res_conv_49_conv;
21789         }
21790         FREE(_res);
21791         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
21792 }
21793
21794 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
21795         LDKCVec_BalanceZ _res_constr;
21796         _res_constr.datalen = _res->arr_len;
21797         if (_res_constr.datalen > 0)
21798                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
21799         else
21800                 _res_constr.data = NULL;
21801         uint64_t* _res_vals = _res->elems;
21802         for (size_t j = 0; j < _res_constr.datalen; j++) {
21803                 uint64_t _res_conv_9 = _res_vals[j];
21804                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
21805                 CHECK_ACCESS(_res_conv_9_ptr);
21806                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
21807                 FREE(untag_ptr(_res_conv_9));
21808                 _res_constr.data[j] = _res_conv_9_conv;
21809         }
21810         FREE(_res);
21811         CVec_BalanceZ_free(_res_constr);
21812 }
21813
21814 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
21815         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
21816         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
21817         return tag_ptr(ret_conv, true);
21818 }
21819 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
21820         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
21821         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
21822         return ret_conv;
21823 }
21824
21825 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
21826         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
21827         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
21828         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
21829         return tag_ptr(ret_conv, true);
21830 }
21831
21832 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
21833         LDKThirtyTwoBytes a_ref;
21834         CHECK(a->arr_len == 32);
21835         memcpy(a_ref.data, a->elems, 32); FREE(a);
21836         LDKChannelMonitor b_conv;
21837         b_conv.inner = untag_ptr(b);
21838         b_conv.is_owned = ptr_is_owned(b);
21839         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21840         b_conv = ChannelMonitor_clone(&b_conv);
21841         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
21842         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
21843         return tag_ptr(ret_conv, true);
21844 }
21845
21846 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
21847         if (!ptr_is_owned(_res)) return;
21848         void* _res_ptr = untag_ptr(_res);
21849         CHECK_ACCESS(_res_ptr);
21850         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
21851         FREE(untag_ptr(_res));
21852         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
21853 }
21854
21855 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
21856         void* o_ptr = untag_ptr(o);
21857         CHECK_ACCESS(o_ptr);
21858         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
21859         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
21860         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
21861         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
21862         return tag_ptr(ret_conv, true);
21863 }
21864
21865 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
21866         void* e_ptr = untag_ptr(e);
21867         CHECK_ACCESS(e_ptr);
21868         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21869         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21870         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
21871         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
21872         return tag_ptr(ret_conv, true);
21873 }
21874
21875 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
21876         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
21877         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
21878         return ret_conv;
21879 }
21880
21881 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
21882         if (!ptr_is_owned(_res)) return;
21883         void* _res_ptr = untag_ptr(_res);
21884         CHECK_ACCESS(_res_ptr);
21885         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
21886         FREE(untag_ptr(_res));
21887         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
21888 }
21889
21890 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
21891         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
21892         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
21893         return tag_ptr(ret_conv, true);
21894 }
21895 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
21896         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
21897         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
21898         return ret_conv;
21899 }
21900
21901 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
21902         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
21903         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
21904         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
21905         return tag_ptr(ret_conv, true);
21906 }
21907
21908 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
21909         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21910         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
21911         return tag_ptr(ret_conv, true);
21912 }
21913 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
21914         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
21915         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
21916         return ret_conv;
21917 }
21918
21919 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
21920         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
21921         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21922         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
21923         return tag_ptr(ret_conv, true);
21924 }
21925
21926 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
21927         LDKPublicKey a_ref;
21928         CHECK(a->arr_len == 33);
21929         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
21930         void* b_ptr = untag_ptr(b);
21931         CHECK_ACCESS(b_ptr);
21932         LDKType b_conv = *(LDKType*)(b_ptr);
21933         if (b_conv.free == LDKType_JCalls_free) {
21934                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21935                 LDKType_JCalls_cloned(&b_conv);
21936         }
21937         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21938         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
21939         return tag_ptr(ret_conv, true);
21940 }
21941
21942 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
21943         if (!ptr_is_owned(_res)) return;
21944         void* _res_ptr = untag_ptr(_res);
21945         CHECK_ACCESS(_res_ptr);
21946         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
21947         FREE(untag_ptr(_res));
21948         C2Tuple_PublicKeyTypeZ_free(_res_conv);
21949 }
21950
21951 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
21952         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
21953         _res_constr.datalen = _res->arr_len;
21954         if (_res_constr.datalen > 0)
21955                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
21956         else
21957                 _res_constr.data = NULL;
21958         uint64_t* _res_vals = _res->elems;
21959         for (size_t z = 0; z < _res_constr.datalen; z++) {
21960                 uint64_t _res_conv_25 = _res_vals[z];
21961                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
21962                 CHECK_ACCESS(_res_conv_25_ptr);
21963                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
21964                 FREE(untag_ptr(_res_conv_25));
21965                 _res_constr.data[z] = _res_conv_25_conv;
21966         }
21967         FREE(_res);
21968         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
21969 }
21970
21971 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
21972         void* o_ptr = untag_ptr(o);
21973         CHECK_ACCESS(o_ptr);
21974         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
21975         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
21976         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21977         *ret_copy = COption_OffersMessageZ_some(o_conv);
21978         uint64_t ret_ref = tag_ptr(ret_copy, true);
21979         return ret_ref;
21980 }
21981
21982 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
21983         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21984         *ret_copy = COption_OffersMessageZ_none();
21985         uint64_t ret_ref = tag_ptr(ret_copy, true);
21986         return ret_ref;
21987 }
21988
21989 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
21990         if (!ptr_is_owned(_res)) return;
21991         void* _res_ptr = untag_ptr(_res);
21992         CHECK_ACCESS(_res_ptr);
21993         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
21994         FREE(untag_ptr(_res));
21995         COption_OffersMessageZ_free(_res_conv);
21996 }
21997
21998 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
21999         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22000         *ret_copy = COption_OffersMessageZ_clone(arg);
22001         uint64_t ret_ref = tag_ptr(ret_copy, true);
22002         return ret_ref;
22003 }
22004 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
22005         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
22006         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
22007         return ret_conv;
22008 }
22009
22010 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
22011         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
22012         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22013         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
22014         uint64_t ret_ref = tag_ptr(ret_copy, true);
22015         return ret_ref;
22016 }
22017
22018 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
22019         void* o_ptr = untag_ptr(o);
22020         CHECK_ACCESS(o_ptr);
22021         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
22022         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
22023                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22024                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
22025         }
22026         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22027         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
22028         uint64_t ret_ref = tag_ptr(ret_copy, true);
22029         return ret_ref;
22030 }
22031
22032 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
22033         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22034         *ret_copy = COption_CustomOnionMessageContentsZ_none();
22035         uint64_t ret_ref = tag_ptr(ret_copy, true);
22036         return ret_ref;
22037 }
22038
22039 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
22040         if (!ptr_is_owned(_res)) return;
22041         void* _res_ptr = untag_ptr(_res);
22042         CHECK_ACCESS(_res_ptr);
22043         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
22044         FREE(untag_ptr(_res));
22045         COption_CustomOnionMessageContentsZ_free(_res_conv);
22046 }
22047
22048 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
22049         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22050         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
22051         uint64_t ret_ref = tag_ptr(ret_copy, true);
22052         return ret_ref;
22053 }
22054 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
22055         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
22056         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
22057         return ret_conv;
22058 }
22059
22060 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
22061         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
22062         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22063         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
22064         uint64_t ret_ref = tag_ptr(ret_copy, true);
22065         return ret_ref;
22066 }
22067
22068 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
22069         void* o_ptr = untag_ptr(o);
22070         CHECK_ACCESS(o_ptr);
22071         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
22072         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
22073         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
22074         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
22075         return tag_ptr(ret_conv, true);
22076 }
22077
22078 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
22079         void* e_ptr = untag_ptr(e);
22080         CHECK_ACCESS(e_ptr);
22081         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22082         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22083         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
22084         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
22085         return tag_ptr(ret_conv, true);
22086 }
22087
22088 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
22089         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
22090         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
22091         return ret_conv;
22092 }
22093
22094 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
22095         if (!ptr_is_owned(_res)) return;
22096         void* _res_ptr = untag_ptr(_res);
22097         CHECK_ACCESS(_res_ptr);
22098         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
22099         FREE(untag_ptr(_res));
22100         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
22101 }
22102
22103 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
22104         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
22105         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
22106         return tag_ptr(ret_conv, true);
22107 }
22108 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
22109         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
22110         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
22111         return ret_conv;
22112 }
22113
22114 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
22115         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
22116         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
22117         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
22118         return tag_ptr(ret_conv, true);
22119 }
22120
22121 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
22122         void* o_ptr = untag_ptr(o);
22123         CHECK_ACCESS(o_ptr);
22124         LDKType o_conv = *(LDKType*)(o_ptr);
22125         if (o_conv.free == LDKType_JCalls_free) {
22126                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22127                 LDKType_JCalls_cloned(&o_conv);
22128         }
22129         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22130         *ret_copy = COption_TypeZ_some(o_conv);
22131         uint64_t ret_ref = tag_ptr(ret_copy, true);
22132         return ret_ref;
22133 }
22134
22135 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
22136         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22137         *ret_copy = COption_TypeZ_none();
22138         uint64_t ret_ref = tag_ptr(ret_copy, true);
22139         return ret_ref;
22140 }
22141
22142 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
22143         if (!ptr_is_owned(_res)) return;
22144         void* _res_ptr = untag_ptr(_res);
22145         CHECK_ACCESS(_res_ptr);
22146         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
22147         FREE(untag_ptr(_res));
22148         COption_TypeZ_free(_res_conv);
22149 }
22150
22151 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
22152         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22153         *ret_copy = COption_TypeZ_clone(arg);
22154         uint64_t ret_ref = tag_ptr(ret_copy, true);
22155         return ret_ref;
22156 }
22157 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
22158         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
22159         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
22160         return ret_conv;
22161 }
22162
22163 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
22164         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
22165         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22166         *ret_copy = COption_TypeZ_clone(orig_conv);
22167         uint64_t ret_ref = tag_ptr(ret_copy, true);
22168         return ret_ref;
22169 }
22170
22171 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
22172         void* o_ptr = untag_ptr(o);
22173         CHECK_ACCESS(o_ptr);
22174         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
22175         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
22176         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22177         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
22178         return tag_ptr(ret_conv, true);
22179 }
22180
22181 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
22182         void* e_ptr = untag_ptr(e);
22183         CHECK_ACCESS(e_ptr);
22184         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22185         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22186         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22187         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
22188         return tag_ptr(ret_conv, true);
22189 }
22190
22191 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
22192         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
22193         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
22194         return ret_conv;
22195 }
22196
22197 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
22198         if (!ptr_is_owned(_res)) return;
22199         void* _res_ptr = untag_ptr(_res);
22200         CHECK_ACCESS(_res_ptr);
22201         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
22202         FREE(untag_ptr(_res));
22203         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
22204 }
22205
22206 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
22207         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22208         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
22209         return tag_ptr(ret_conv, true);
22210 }
22211 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
22212         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
22213         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
22214         return ret_conv;
22215 }
22216
22217 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
22218         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
22219         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22220         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
22221         return tag_ptr(ret_conv, true);
22222 }
22223
22224 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
22225         void* o_ptr = untag_ptr(o);
22226         CHECK_ACCESS(o_ptr);
22227         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
22228         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
22229         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22230         *ret_copy = COption_SocketAddressZ_some(o_conv);
22231         uint64_t ret_ref = tag_ptr(ret_copy, true);
22232         return ret_ref;
22233 }
22234
22235 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
22236         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22237         *ret_copy = COption_SocketAddressZ_none();
22238         uint64_t ret_ref = tag_ptr(ret_copy, true);
22239         return ret_ref;
22240 }
22241
22242 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
22243         if (!ptr_is_owned(_res)) return;
22244         void* _res_ptr = untag_ptr(_res);
22245         CHECK_ACCESS(_res_ptr);
22246         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
22247         FREE(untag_ptr(_res));
22248         COption_SocketAddressZ_free(_res_conv);
22249 }
22250
22251 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
22252         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22253         *ret_copy = COption_SocketAddressZ_clone(arg);
22254         uint64_t ret_ref = tag_ptr(ret_copy, true);
22255         return ret_ref;
22256 }
22257 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
22258         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
22259         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
22260         return ret_conv;
22261 }
22262
22263 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
22264         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
22265         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22266         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
22267         uint64_t ret_ref = tag_ptr(ret_copy, true);
22268         return ret_ref;
22269 }
22270
22271 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
22272         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22273         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
22274         return tag_ptr(ret_conv, true);
22275 }
22276 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(uint64_t arg) {
22277         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
22278         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
22279         return ret_conv;
22280 }
22281
22282 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(uint64_t orig) {
22283         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
22284         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22285         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
22286         return tag_ptr(ret_conv, true);
22287 }
22288
22289 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new(int8_tArray a, uint64_t b) {
22290         LDKPublicKey a_ref;
22291         CHECK(a->arr_len == 33);
22292         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
22293         void* b_ptr = untag_ptr(b);
22294         CHECK_ACCESS(b_ptr);
22295         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
22296         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
22297         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22298         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
22299         return tag_ptr(ret_conv, true);
22300 }
22301
22302 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free(uint64_t _res) {
22303         if (!ptr_is_owned(_res)) return;
22304         void* _res_ptr = untag_ptr(_res);
22305         CHECK_ACCESS(_res_ptr);
22306         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
22307         FREE(untag_ptr(_res));
22308         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
22309 }
22310
22311 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(uint64_tArray _res) {
22312         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
22313         _res_constr.datalen = _res->arr_len;
22314         if (_res_constr.datalen > 0)
22315                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
22316         else
22317                 _res_constr.data = NULL;
22318         uint64_t* _res_vals = _res->elems;
22319         for (size_t r = 0; r < _res_constr.datalen; r++) {
22320                 uint64_t _res_conv_43 = _res_vals[r];
22321                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
22322                 CHECK_ACCESS(_res_conv_43_ptr);
22323                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
22324                 FREE(untag_ptr(_res_conv_43));
22325                 _res_constr.data[r] = _res_conv_43_conv;
22326         }
22327         FREE(_res);
22328         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
22329 }
22330
22331 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
22332         LDKCVec_u8Z o_ref;
22333         o_ref.datalen = o->arr_len;
22334         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22335         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
22336         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22337         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
22338         return tag_ptr(ret_conv, true);
22339 }
22340
22341 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
22342         LDKPeerHandleError e_conv;
22343         e_conv.inner = untag_ptr(e);
22344         e_conv.is_owned = ptr_is_owned(e);
22345         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22346         e_conv = PeerHandleError_clone(&e_conv);
22347         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22348         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
22349         return tag_ptr(ret_conv, true);
22350 }
22351
22352 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
22353         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
22354         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
22355         return ret_conv;
22356 }
22357
22358 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
22359         if (!ptr_is_owned(_res)) return;
22360         void* _res_ptr = untag_ptr(_res);
22361         CHECK_ACCESS(_res_ptr);
22362         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
22363         FREE(untag_ptr(_res));
22364         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
22365 }
22366
22367 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
22368         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22369         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
22370         return tag_ptr(ret_conv, true);
22371 }
22372 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
22373         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
22374         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
22375         return ret_conv;
22376 }
22377
22378 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
22379         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
22380         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22381         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
22382         return tag_ptr(ret_conv, true);
22383 }
22384
22385 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
22386         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22387         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
22388         return tag_ptr(ret_conv, true);
22389 }
22390
22391 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
22392         LDKPeerHandleError e_conv;
22393         e_conv.inner = untag_ptr(e);
22394         e_conv.is_owned = ptr_is_owned(e);
22395         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22396         e_conv = PeerHandleError_clone(&e_conv);
22397         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22398         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
22399         return tag_ptr(ret_conv, true);
22400 }
22401
22402 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
22403         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
22404         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
22405         return ret_conv;
22406 }
22407
22408 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
22409         if (!ptr_is_owned(_res)) return;
22410         void* _res_ptr = untag_ptr(_res);
22411         CHECK_ACCESS(_res_ptr);
22412         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
22413         FREE(untag_ptr(_res));
22414         CResult_NonePeerHandleErrorZ_free(_res_conv);
22415 }
22416
22417 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
22418         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22419         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
22420         return tag_ptr(ret_conv, true);
22421 }
22422 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
22423         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
22424         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
22425         return ret_conv;
22426 }
22427
22428 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
22429         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
22430         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22431         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
22432         return tag_ptr(ret_conv, true);
22433 }
22434
22435 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
22436         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22437         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
22438         return tag_ptr(ret_conv, true);
22439 }
22440
22441 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
22442         LDKPeerHandleError e_conv;
22443         e_conv.inner = untag_ptr(e);
22444         e_conv.is_owned = ptr_is_owned(e);
22445         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22446         e_conv = PeerHandleError_clone(&e_conv);
22447         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22448         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
22449         return tag_ptr(ret_conv, true);
22450 }
22451
22452 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
22453         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
22454         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
22455         return ret_conv;
22456 }
22457
22458 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
22459         if (!ptr_is_owned(_res)) return;
22460         void* _res_ptr = untag_ptr(_res);
22461         CHECK_ACCESS(_res_ptr);
22462         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
22463         FREE(untag_ptr(_res));
22464         CResult_boolPeerHandleErrorZ_free(_res_conv);
22465 }
22466
22467 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
22468         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22469         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
22470         return tag_ptr(ret_conv, true);
22471 }
22472 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
22473         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
22474         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
22475         return ret_conv;
22476 }
22477
22478 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
22479         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
22480         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22481         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
22482         return tag_ptr(ret_conv, true);
22483 }
22484
22485 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
22486         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22487         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
22488         return tag_ptr(ret_conv, true);
22489 }
22490
22491 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
22492         void* e_ptr = untag_ptr(e);
22493         CHECK_ACCESS(e_ptr);
22494         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
22495         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
22496         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22497         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
22498         return tag_ptr(ret_conv, true);
22499 }
22500
22501 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
22502         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
22503         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
22504         return ret_conv;
22505 }
22506
22507 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
22508         if (!ptr_is_owned(_res)) return;
22509         void* _res_ptr = untag_ptr(_res);
22510         CHECK_ACCESS(_res_ptr);
22511         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
22512         FREE(untag_ptr(_res));
22513         CResult_u32GraphSyncErrorZ_free(_res_conv);
22514 }
22515
22516 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
22517         LDKCVec_u8Z o_ref;
22518         o_ref.datalen = o->arr_len;
22519         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22520         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
22521         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22522         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
22523         return tag_ptr(ret_conv, true);
22524 }
22525
22526 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
22527         LDKIOError e_conv = LDKIOError_from_js(e);
22528         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22529         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
22530         return tag_ptr(ret_conv, true);
22531 }
22532
22533 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
22534         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
22535         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
22536         return ret_conv;
22537 }
22538
22539 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
22540         if (!ptr_is_owned(_res)) return;
22541         void* _res_ptr = untag_ptr(_res);
22542         CHECK_ACCESS(_res_ptr);
22543         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
22544         FREE(untag_ptr(_res));
22545         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
22546 }
22547
22548 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
22549         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22550         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
22551         return tag_ptr(ret_conv, true);
22552 }
22553 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
22554         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
22555         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
22556         return ret_conv;
22557 }
22558
22559 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
22560         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
22561         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22562         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
22563         return tag_ptr(ret_conv, true);
22564 }
22565
22566 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
22567         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22568         *ret_conv = CResult_NoneIOErrorZ_ok();
22569         return tag_ptr(ret_conv, true);
22570 }
22571
22572 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
22573         LDKIOError e_conv = LDKIOError_from_js(e);
22574         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22575         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
22576         return tag_ptr(ret_conv, true);
22577 }
22578
22579 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
22580         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
22581         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
22582         return ret_conv;
22583 }
22584
22585 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_free(uint64_t _res) {
22586         if (!ptr_is_owned(_res)) return;
22587         void* _res_ptr = untag_ptr(_res);
22588         CHECK_ACCESS(_res_ptr);
22589         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
22590         FREE(untag_ptr(_res));
22591         CResult_NoneIOErrorZ_free(_res_conv);
22592 }
22593
22594 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
22595         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22596         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
22597         return tag_ptr(ret_conv, true);
22598 }
22599 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
22600         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
22601         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
22602         return ret_conv;
22603 }
22604
22605 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
22606         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
22607         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22608         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
22609         return tag_ptr(ret_conv, true);
22610 }
22611
22612 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
22613         LDKCVec_StrZ _res_constr;
22614         _res_constr.datalen = _res->arr_len;
22615         if (_res_constr.datalen > 0)
22616                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
22617         else
22618                 _res_constr.data = NULL;
22619         jstring* _res_vals = (void*) _res->elems;
22620         for (size_t i = 0; i < _res_constr.datalen; i++) {
22621                 jstring _res_conv_8 = _res_vals[i];
22622                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
22623                 _res_constr.data[i] = dummy;
22624         }
22625         FREE(_res);
22626         CVec_StrZ_free(_res_constr);
22627 }
22628
22629 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
22630         LDKCVec_StrZ o_constr;
22631         o_constr.datalen = o->arr_len;
22632         if (o_constr.datalen > 0)
22633                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
22634         else
22635                 o_constr.data = NULL;
22636         jstring* o_vals = (void*) o->elems;
22637         for (size_t i = 0; i < o_constr.datalen; i++) {
22638                 jstring o_conv_8 = o_vals[i];
22639                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
22640                 o_constr.data[i] = o_conv_8_conv;
22641         }
22642         FREE(o);
22643         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
22644         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
22645         return tag_ptr(ret_conv, true);
22646 }
22647
22648 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
22649         LDKIOError e_conv = LDKIOError_from_js(e);
22650         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
22651         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
22652         return tag_ptr(ret_conv, true);
22653 }
22654
22655 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
22656         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
22657         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
22658         return ret_conv;
22659 }
22660
22661 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_free(uint64_t _res) {
22662         if (!ptr_is_owned(_res)) return;
22663         void* _res_ptr = untag_ptr(_res);
22664         CHECK_ACCESS(_res_ptr);
22665         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
22666         FREE(untag_ptr(_res));
22667         CResult_CVec_StrZIOErrorZ_free(_res_conv);
22668 }
22669
22670 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
22671         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
22672         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
22673         return tag_ptr(ret_conv, true);
22674 }
22675 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
22676         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
22677         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
22678         return ret_conv;
22679 }
22680
22681 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
22682         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
22683         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
22684         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
22685         return tag_ptr(ret_conv, true);
22686 }
22687
22688 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
22689         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
22690         _res_constr.datalen = _res->arr_len;
22691         if (_res_constr.datalen > 0)
22692                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
22693         else
22694                 _res_constr.data = NULL;
22695         uint64_t* _res_vals = _res->elems;
22696         for (size_t o = 0; o < _res_constr.datalen; o++) {
22697                 uint64_t _res_conv_40 = _res_vals[o];
22698                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22699                 CHECK_ACCESS(_res_conv_40_ptr);
22700                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
22701                 FREE(untag_ptr(_res_conv_40));
22702                 _res_constr.data[o] = _res_conv_40_conv;
22703         }
22704         FREE(_res);
22705         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
22706 }
22707
22708 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
22709         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
22710         o_constr.datalen = o->arr_len;
22711         if (o_constr.datalen > 0)
22712                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
22713         else
22714                 o_constr.data = NULL;
22715         uint64_t* o_vals = o->elems;
22716         for (size_t o = 0; o < o_constr.datalen; o++) {
22717                 uint64_t o_conv_40 = o_vals[o];
22718                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
22719                 CHECK_ACCESS(o_conv_40_ptr);
22720                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
22721                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
22722                 o_constr.data[o] = o_conv_40_conv;
22723         }
22724         FREE(o);
22725         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
22726         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
22727         return tag_ptr(ret_conv, true);
22728 }
22729
22730 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
22731         LDKIOError e_conv = LDKIOError_from_js(e);
22732         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
22733         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
22734         return tag_ptr(ret_conv, true);
22735 }
22736
22737 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
22738         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
22739         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
22740         return ret_conv;
22741 }
22742
22743 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
22744         if (!ptr_is_owned(_res)) return;
22745         void* _res_ptr = untag_ptr(_res);
22746         CHECK_ACCESS(_res_ptr);
22747         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
22748         FREE(untag_ptr(_res));
22749         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
22750 }
22751
22752 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
22753         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
22754         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
22755         return tag_ptr(ret_conv, true);
22756 }
22757 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
22758         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
22759         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
22760         return ret_conv;
22761 }
22762
22763 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
22764         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
22765         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
22766         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
22767         return tag_ptr(ret_conv, true);
22768 }
22769
22770 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
22771         void* o_ptr = untag_ptr(o);
22772         CHECK_ACCESS(o_ptr);
22773         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
22774         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
22775         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
22776         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
22777         return tag_ptr(ret_conv, true);
22778 }
22779
22780 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
22781         LDKIOError e_conv = LDKIOError_from_js(e);
22782         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
22783         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
22784         return tag_ptr(ret_conv, true);
22785 }
22786
22787 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
22788         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
22789         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
22790         return ret_conv;
22791 }
22792
22793 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
22794         if (!ptr_is_owned(_res)) return;
22795         void* _res_ptr = untag_ptr(_res);
22796         CHECK_ACCESS(_res_ptr);
22797         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
22798         FREE(untag_ptr(_res));
22799         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
22800 }
22801
22802 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
22803         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
22804         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
22805         return tag_ptr(ret_conv, true);
22806 }
22807 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
22808         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
22809         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
22810         return ret_conv;
22811 }
22812
22813 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
22814         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
22815         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
22816         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
22817         return tag_ptr(ret_conv, true);
22818 }
22819
22820 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
22821         LDKSecretKey o_ref;
22822         CHECK(o->arr_len == 32);
22823         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
22824         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
22825         *ret_copy = COption_SecretKeyZ_some(o_ref);
22826         uint64_t ret_ref = tag_ptr(ret_copy, true);
22827         return ret_ref;
22828 }
22829
22830 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
22831         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
22832         *ret_copy = COption_SecretKeyZ_none();
22833         uint64_t ret_ref = tag_ptr(ret_copy, true);
22834         return ret_ref;
22835 }
22836
22837 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
22838         if (!ptr_is_owned(_res)) return;
22839         void* _res_ptr = untag_ptr(_res);
22840         CHECK_ACCESS(_res_ptr);
22841         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
22842         FREE(untag_ptr(_res));
22843         COption_SecretKeyZ_free(_res_conv);
22844 }
22845
22846 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
22847         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
22848         *ret_copy = COption_SecretKeyZ_clone(arg);
22849         uint64_t ret_ref = tag_ptr(ret_copy, true);
22850         return ret_ref;
22851 }
22852 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
22853         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
22854         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
22855         return ret_conv;
22856 }
22857
22858 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
22859         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
22860         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
22861         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
22862         uint64_t ret_ref = tag_ptr(ret_copy, true);
22863         return ret_ref;
22864 }
22865
22866 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
22867         LDKVerifiedInvoiceRequest o_conv;
22868         o_conv.inner = untag_ptr(o);
22869         o_conv.is_owned = ptr_is_owned(o);
22870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22871         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
22872         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
22873         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
22874         return tag_ptr(ret_conv, true);
22875 }
22876
22877 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
22878         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
22879         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
22880         return tag_ptr(ret_conv, true);
22881 }
22882
22883 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
22884         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
22885         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
22886         return ret_conv;
22887 }
22888
22889 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
22890         if (!ptr_is_owned(_res)) return;
22891         void* _res_ptr = untag_ptr(_res);
22892         CHECK_ACCESS(_res_ptr);
22893         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
22894         FREE(untag_ptr(_res));
22895         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
22896 }
22897
22898 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
22899         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
22900         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
22901         return tag_ptr(ret_conv, true);
22902 }
22903 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
22904         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
22905         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
22906         return ret_conv;
22907 }
22908
22909 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
22910         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
22911         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
22912         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
22913         return tag_ptr(ret_conv, true);
22914 }
22915
22916 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
22917         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
22918         return ret_conv;
22919 }
22920
22921 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
22922         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
22923         return ret_conv;
22924 }
22925
22926 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
22927         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
22928         COption_NoneZ_free(_res_conv);
22929 }
22930
22931 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
22932         LDKCVec_WitnessZ _res_constr;
22933         _res_constr.datalen = _res->arr_len;
22934         if (_res_constr.datalen > 0)
22935                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
22936         else
22937                 _res_constr.data = NULL;
22938         int8_tArray* _res_vals = (void*) _res->elems;
22939         for (size_t m = 0; m < _res_constr.datalen; m++) {
22940                 int8_tArray _res_conv_12 = _res_vals[m];
22941                 LDKWitness _res_conv_12_ref;
22942                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
22943                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
22944                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
22945                 _res_conv_12_ref.data_is_owned = true;
22946                 _res_constr.data[m] = _res_conv_12_ref;
22947         }
22948         FREE(_res);
22949         CVec_WitnessZ_free(_res_constr);
22950 }
22951
22952 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
22953         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
22954         *ret_copy = COption_i64Z_some(o);
22955         uint64_t ret_ref = tag_ptr(ret_copy, true);
22956         return ret_ref;
22957 }
22958
22959 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
22960         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
22961         *ret_copy = COption_i64Z_none();
22962         uint64_t ret_ref = tag_ptr(ret_copy, true);
22963         return ret_ref;
22964 }
22965
22966 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
22967         if (!ptr_is_owned(_res)) return;
22968         void* _res_ptr = untag_ptr(_res);
22969         CHECK_ACCESS(_res_ptr);
22970         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
22971         FREE(untag_ptr(_res));
22972         COption_i64Z_free(_res_conv);
22973 }
22974
22975 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
22976         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
22977         *ret_copy = COption_i64Z_clone(arg);
22978         uint64_t ret_ref = tag_ptr(ret_copy, true);
22979         return ret_ref;
22980 }
22981 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
22982         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
22983         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
22984         return ret_conv;
22985 }
22986
22987 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
22988         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
22989         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
22990         *ret_copy = COption_i64Z_clone(orig_conv);
22991         uint64_t ret_ref = tag_ptr(ret_copy, true);
22992         return ret_ref;
22993 }
22994
22995 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
22996         void* o_ptr = untag_ptr(o);
22997         CHECK_ACCESS(o_ptr);
22998         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
22999         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
23000         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23001         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
23002         return tag_ptr(ret_conv, true);
23003 }
23004
23005 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_err(uint64_t e) {
23006         void* e_ptr = untag_ptr(e);
23007         CHECK_ACCESS(e_ptr);
23008         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23009         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23010         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23011         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
23012         return tag_ptr(ret_conv, true);
23013 }
23014
23015 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
23016         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
23017         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
23018         return ret_conv;
23019 }
23020
23021 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_free(uint64_t _res) {
23022         if (!ptr_is_owned(_res)) return;
23023         void* _res_ptr = untag_ptr(_res);
23024         CHECK_ACCESS(_res_ptr);
23025         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
23026         FREE(untag_ptr(_res));
23027         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
23028 }
23029
23030 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
23031         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23032         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
23033         return tag_ptr(ret_conv, true);
23034 }
23035 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
23036         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
23037         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
23038         return ret_conv;
23039 }
23040
23041 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
23042         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
23043         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23044         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
23045         return tag_ptr(ret_conv, true);
23046 }
23047
23048 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
23049         void* o_ptr = untag_ptr(o);
23050         CHECK_ACCESS(o_ptr);
23051         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
23052         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
23053         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23054         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
23055         return tag_ptr(ret_conv, true);
23056 }
23057
23058 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
23059         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
23060         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23061         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
23062         return tag_ptr(ret_conv, true);
23063 }
23064
23065 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
23066         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
23067         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
23068         return ret_conv;
23069 }
23070
23071 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
23072         if (!ptr_is_owned(_res)) return;
23073         void* _res_ptr = untag_ptr(_res);
23074         CHECK_ACCESS(_res_ptr);
23075         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
23076         FREE(untag_ptr(_res));
23077         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
23078 }
23079
23080 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
23081         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23082         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
23083         return tag_ptr(ret_conv, true);
23084 }
23085 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
23086         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
23087         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
23088         return ret_conv;
23089 }
23090
23091 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
23092         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
23093         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23094         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
23095         return tag_ptr(ret_conv, true);
23096 }
23097
23098 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
23099         LDKCVec_UpdateAddHTLCZ _res_constr;
23100         _res_constr.datalen = _res->arr_len;
23101         if (_res_constr.datalen > 0)
23102                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23103         else
23104                 _res_constr.data = NULL;
23105         uint64_t* _res_vals = _res->elems;
23106         for (size_t p = 0; p < _res_constr.datalen; p++) {
23107                 uint64_t _res_conv_15 = _res_vals[p];
23108                 LDKUpdateAddHTLC _res_conv_15_conv;
23109                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
23110                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
23111                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
23112                 _res_constr.data[p] = _res_conv_15_conv;
23113         }
23114         FREE(_res);
23115         CVec_UpdateAddHTLCZ_free(_res_constr);
23116 }
23117
23118 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
23119         LDKCVec_UpdateFulfillHTLCZ _res_constr;
23120         _res_constr.datalen = _res->arr_len;
23121         if (_res_constr.datalen > 0)
23122                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23123         else
23124                 _res_constr.data = NULL;
23125         uint64_t* _res_vals = _res->elems;
23126         for (size_t t = 0; t < _res_constr.datalen; t++) {
23127                 uint64_t _res_conv_19 = _res_vals[t];
23128                 LDKUpdateFulfillHTLC _res_conv_19_conv;
23129                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
23130                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
23131                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23132                 _res_constr.data[t] = _res_conv_19_conv;
23133         }
23134         FREE(_res);
23135         CVec_UpdateFulfillHTLCZ_free(_res_constr);
23136 }
23137
23138 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
23139         LDKCVec_UpdateFailHTLCZ _res_constr;
23140         _res_constr.datalen = _res->arr_len;
23141         if (_res_constr.datalen > 0)
23142                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23143         else
23144                 _res_constr.data = NULL;
23145         uint64_t* _res_vals = _res->elems;
23146         for (size_t q = 0; q < _res_constr.datalen; q++) {
23147                 uint64_t _res_conv_16 = _res_vals[q];
23148                 LDKUpdateFailHTLC _res_conv_16_conv;
23149                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23150                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23151                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23152                 _res_constr.data[q] = _res_conv_16_conv;
23153         }
23154         FREE(_res);
23155         CVec_UpdateFailHTLCZ_free(_res_constr);
23156 }
23157
23158 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
23159         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
23160         _res_constr.datalen = _res->arr_len;
23161         if (_res_constr.datalen > 0)
23162                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23163         else
23164                 _res_constr.data = NULL;
23165         uint64_t* _res_vals = _res->elems;
23166         for (size_t z = 0; z < _res_constr.datalen; z++) {
23167                 uint64_t _res_conv_25 = _res_vals[z];
23168                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
23169                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
23170                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
23171                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
23172                 _res_constr.data[z] = _res_conv_25_conv;
23173         }
23174         FREE(_res);
23175         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
23176 }
23177
23178 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
23179         LDKAcceptChannel o_conv;
23180         o_conv.inner = untag_ptr(o);
23181         o_conv.is_owned = ptr_is_owned(o);
23182         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23183         o_conv = AcceptChannel_clone(&o_conv);
23184         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23185         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
23186         return tag_ptr(ret_conv, true);
23187 }
23188
23189 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
23190         void* e_ptr = untag_ptr(e);
23191         CHECK_ACCESS(e_ptr);
23192         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23193         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23194         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23195         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
23196         return tag_ptr(ret_conv, true);
23197 }
23198
23199 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
23200         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
23201         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
23202         return ret_conv;
23203 }
23204
23205 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
23206         if (!ptr_is_owned(_res)) return;
23207         void* _res_ptr = untag_ptr(_res);
23208         CHECK_ACCESS(_res_ptr);
23209         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
23210         FREE(untag_ptr(_res));
23211         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
23212 }
23213
23214 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
23215         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23216         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
23217         return tag_ptr(ret_conv, true);
23218 }
23219 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
23220         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
23221         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
23222         return ret_conv;
23223 }
23224
23225 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
23226         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
23227         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23228         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
23229         return tag_ptr(ret_conv, true);
23230 }
23231
23232 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
23233         LDKAcceptChannelV2 o_conv;
23234         o_conv.inner = untag_ptr(o);
23235         o_conv.is_owned = ptr_is_owned(o);
23236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23237         o_conv = AcceptChannelV2_clone(&o_conv);
23238         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23239         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
23240         return tag_ptr(ret_conv, true);
23241 }
23242
23243 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
23244         void* e_ptr = untag_ptr(e);
23245         CHECK_ACCESS(e_ptr);
23246         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23247         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23248         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23249         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
23250         return tag_ptr(ret_conv, true);
23251 }
23252
23253 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
23254         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
23255         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
23256         return ret_conv;
23257 }
23258
23259 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
23260         if (!ptr_is_owned(_res)) return;
23261         void* _res_ptr = untag_ptr(_res);
23262         CHECK_ACCESS(_res_ptr);
23263         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
23264         FREE(untag_ptr(_res));
23265         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
23266 }
23267
23268 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
23269         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23270         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
23271         return tag_ptr(ret_conv, true);
23272 }
23273 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
23274         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
23275         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
23276         return ret_conv;
23277 }
23278
23279 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
23280         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
23281         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23282         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
23283         return tag_ptr(ret_conv, true);
23284 }
23285
23286 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
23287         LDKTxAddInput o_conv;
23288         o_conv.inner = untag_ptr(o);
23289         o_conv.is_owned = ptr_is_owned(o);
23290         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23291         o_conv = TxAddInput_clone(&o_conv);
23292         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23293         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
23294         return tag_ptr(ret_conv, true);
23295 }
23296
23297 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
23298         void* e_ptr = untag_ptr(e);
23299         CHECK_ACCESS(e_ptr);
23300         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23301         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23302         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23303         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
23304         return tag_ptr(ret_conv, true);
23305 }
23306
23307 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
23308         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
23309         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
23310         return ret_conv;
23311 }
23312
23313 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
23314         if (!ptr_is_owned(_res)) return;
23315         void* _res_ptr = untag_ptr(_res);
23316         CHECK_ACCESS(_res_ptr);
23317         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
23318         FREE(untag_ptr(_res));
23319         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
23320 }
23321
23322 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
23323         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23324         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
23325         return tag_ptr(ret_conv, true);
23326 }
23327 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
23328         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
23329         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
23330         return ret_conv;
23331 }
23332
23333 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
23334         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
23335         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23336         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
23337         return tag_ptr(ret_conv, true);
23338 }
23339
23340 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
23341         LDKTxAddOutput o_conv;
23342         o_conv.inner = untag_ptr(o);
23343         o_conv.is_owned = ptr_is_owned(o);
23344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23345         o_conv = TxAddOutput_clone(&o_conv);
23346         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23347         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
23348         return tag_ptr(ret_conv, true);
23349 }
23350
23351 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
23352         void* e_ptr = untag_ptr(e);
23353         CHECK_ACCESS(e_ptr);
23354         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23355         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23356         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23357         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
23358         return tag_ptr(ret_conv, true);
23359 }
23360
23361 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
23362         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
23363         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
23364         return ret_conv;
23365 }
23366
23367 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
23368         if (!ptr_is_owned(_res)) return;
23369         void* _res_ptr = untag_ptr(_res);
23370         CHECK_ACCESS(_res_ptr);
23371         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
23372         FREE(untag_ptr(_res));
23373         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
23374 }
23375
23376 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
23377         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23378         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
23379         return tag_ptr(ret_conv, true);
23380 }
23381 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
23382         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
23383         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
23384         return ret_conv;
23385 }
23386
23387 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
23388         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
23389         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23390         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
23391         return tag_ptr(ret_conv, true);
23392 }
23393
23394 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
23395         LDKTxRemoveInput o_conv;
23396         o_conv.inner = untag_ptr(o);
23397         o_conv.is_owned = ptr_is_owned(o);
23398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23399         o_conv = TxRemoveInput_clone(&o_conv);
23400         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23401         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
23402         return tag_ptr(ret_conv, true);
23403 }
23404
23405 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
23406         void* e_ptr = untag_ptr(e);
23407         CHECK_ACCESS(e_ptr);
23408         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23409         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23410         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23411         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
23412         return tag_ptr(ret_conv, true);
23413 }
23414
23415 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
23416         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
23417         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
23418         return ret_conv;
23419 }
23420
23421 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
23422         if (!ptr_is_owned(_res)) return;
23423         void* _res_ptr = untag_ptr(_res);
23424         CHECK_ACCESS(_res_ptr);
23425         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
23426         FREE(untag_ptr(_res));
23427         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
23428 }
23429
23430 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
23431         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23432         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
23433         return tag_ptr(ret_conv, true);
23434 }
23435 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
23436         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
23437         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
23438         return ret_conv;
23439 }
23440
23441 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
23442         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
23443         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23444         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
23445         return tag_ptr(ret_conv, true);
23446 }
23447
23448 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
23449         LDKTxRemoveOutput o_conv;
23450         o_conv.inner = untag_ptr(o);
23451         o_conv.is_owned = ptr_is_owned(o);
23452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23453         o_conv = TxRemoveOutput_clone(&o_conv);
23454         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23455         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
23456         return tag_ptr(ret_conv, true);
23457 }
23458
23459 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
23460         void* e_ptr = untag_ptr(e);
23461         CHECK_ACCESS(e_ptr);
23462         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23463         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23464         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23465         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
23466         return tag_ptr(ret_conv, true);
23467 }
23468
23469 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
23470         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
23471         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
23472         return ret_conv;
23473 }
23474
23475 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
23476         if (!ptr_is_owned(_res)) return;
23477         void* _res_ptr = untag_ptr(_res);
23478         CHECK_ACCESS(_res_ptr);
23479         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
23480         FREE(untag_ptr(_res));
23481         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
23482 }
23483
23484 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
23485         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23486         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
23487         return tag_ptr(ret_conv, true);
23488 }
23489 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
23490         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
23491         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
23492         return ret_conv;
23493 }
23494
23495 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
23496         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
23497         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23498         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
23499         return tag_ptr(ret_conv, true);
23500 }
23501
23502 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
23503         LDKTxComplete o_conv;
23504         o_conv.inner = untag_ptr(o);
23505         o_conv.is_owned = ptr_is_owned(o);
23506         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23507         o_conv = TxComplete_clone(&o_conv);
23508         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23509         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
23510         return tag_ptr(ret_conv, true);
23511 }
23512
23513 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
23514         void* e_ptr = untag_ptr(e);
23515         CHECK_ACCESS(e_ptr);
23516         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23517         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23518         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23519         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
23520         return tag_ptr(ret_conv, true);
23521 }
23522
23523 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
23524         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
23525         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
23526         return ret_conv;
23527 }
23528
23529 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
23530         if (!ptr_is_owned(_res)) return;
23531         void* _res_ptr = untag_ptr(_res);
23532         CHECK_ACCESS(_res_ptr);
23533         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
23534         FREE(untag_ptr(_res));
23535         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
23536 }
23537
23538 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
23539         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23540         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
23541         return tag_ptr(ret_conv, true);
23542 }
23543 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
23544         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
23545         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
23546         return ret_conv;
23547 }
23548
23549 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
23550         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
23551         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23552         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
23553         return tag_ptr(ret_conv, true);
23554 }
23555
23556 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
23557         LDKTxSignatures o_conv;
23558         o_conv.inner = untag_ptr(o);
23559         o_conv.is_owned = ptr_is_owned(o);
23560         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23561         o_conv = TxSignatures_clone(&o_conv);
23562         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
23563         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
23564         return tag_ptr(ret_conv, true);
23565 }
23566
23567 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
23568         void* e_ptr = untag_ptr(e);
23569         CHECK_ACCESS(e_ptr);
23570         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23571         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23572         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
23573         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
23574         return tag_ptr(ret_conv, true);
23575 }
23576
23577 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
23578         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
23579         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
23580         return ret_conv;
23581 }
23582
23583 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
23584         if (!ptr_is_owned(_res)) return;
23585         void* _res_ptr = untag_ptr(_res);
23586         CHECK_ACCESS(_res_ptr);
23587         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
23588         FREE(untag_ptr(_res));
23589         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
23590 }
23591
23592 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
23593         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
23594         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
23595         return tag_ptr(ret_conv, true);
23596 }
23597 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
23598         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
23599         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
23600         return ret_conv;
23601 }
23602
23603 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
23604         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
23605         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
23606         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
23607         return tag_ptr(ret_conv, true);
23608 }
23609
23610 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
23611         LDKTxInitRbf o_conv;
23612         o_conv.inner = untag_ptr(o);
23613         o_conv.is_owned = ptr_is_owned(o);
23614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23615         o_conv = TxInitRbf_clone(&o_conv);
23616         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
23617         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
23618         return tag_ptr(ret_conv, true);
23619 }
23620
23621 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
23622         void* e_ptr = untag_ptr(e);
23623         CHECK_ACCESS(e_ptr);
23624         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23625         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23626         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
23627         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
23628         return tag_ptr(ret_conv, true);
23629 }
23630
23631 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
23632         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
23633         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
23634         return ret_conv;
23635 }
23636
23637 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
23638         if (!ptr_is_owned(_res)) return;
23639         void* _res_ptr = untag_ptr(_res);
23640         CHECK_ACCESS(_res_ptr);
23641         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
23642         FREE(untag_ptr(_res));
23643         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
23644 }
23645
23646 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
23647         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
23648         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
23649         return tag_ptr(ret_conv, true);
23650 }
23651 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
23652         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
23653         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
23654         return ret_conv;
23655 }
23656
23657 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
23658         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
23659         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
23660         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
23661         return tag_ptr(ret_conv, true);
23662 }
23663
23664 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
23665         LDKTxAckRbf o_conv;
23666         o_conv.inner = untag_ptr(o);
23667         o_conv.is_owned = ptr_is_owned(o);
23668         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23669         o_conv = TxAckRbf_clone(&o_conv);
23670         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
23671         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
23672         return tag_ptr(ret_conv, true);
23673 }
23674
23675 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
23676         void* e_ptr = untag_ptr(e);
23677         CHECK_ACCESS(e_ptr);
23678         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23679         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23680         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
23681         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
23682         return tag_ptr(ret_conv, true);
23683 }
23684
23685 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
23686         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
23687         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
23688         return ret_conv;
23689 }
23690
23691 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
23692         if (!ptr_is_owned(_res)) return;
23693         void* _res_ptr = untag_ptr(_res);
23694         CHECK_ACCESS(_res_ptr);
23695         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
23696         FREE(untag_ptr(_res));
23697         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
23698 }
23699
23700 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
23701         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
23702         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
23703         return tag_ptr(ret_conv, true);
23704 }
23705 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
23706         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
23707         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
23708         return ret_conv;
23709 }
23710
23711 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
23712         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
23713         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
23714         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
23715         return tag_ptr(ret_conv, true);
23716 }
23717
23718 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
23719         LDKTxAbort o_conv;
23720         o_conv.inner = untag_ptr(o);
23721         o_conv.is_owned = ptr_is_owned(o);
23722         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23723         o_conv = TxAbort_clone(&o_conv);
23724         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
23725         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
23726         return tag_ptr(ret_conv, true);
23727 }
23728
23729 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
23730         void* e_ptr = untag_ptr(e);
23731         CHECK_ACCESS(e_ptr);
23732         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23733         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23734         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
23735         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
23736         return tag_ptr(ret_conv, true);
23737 }
23738
23739 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
23740         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
23741         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
23742         return ret_conv;
23743 }
23744
23745 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
23746         if (!ptr_is_owned(_res)) return;
23747         void* _res_ptr = untag_ptr(_res);
23748         CHECK_ACCESS(_res_ptr);
23749         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
23750         FREE(untag_ptr(_res));
23751         CResult_TxAbortDecodeErrorZ_free(_res_conv);
23752 }
23753
23754 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
23755         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
23756         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
23757         return tag_ptr(ret_conv, true);
23758 }
23759 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
23760         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
23761         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
23762         return ret_conv;
23763 }
23764
23765 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
23766         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
23767         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
23768         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
23769         return tag_ptr(ret_conv, true);
23770 }
23771
23772 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
23773         LDKAnnouncementSignatures o_conv;
23774         o_conv.inner = untag_ptr(o);
23775         o_conv.is_owned = ptr_is_owned(o);
23776         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23777         o_conv = AnnouncementSignatures_clone(&o_conv);
23778         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23779         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
23780         return tag_ptr(ret_conv, true);
23781 }
23782
23783 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
23784         void* e_ptr = untag_ptr(e);
23785         CHECK_ACCESS(e_ptr);
23786         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23787         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23788         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23789         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
23790         return tag_ptr(ret_conv, true);
23791 }
23792
23793 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
23794         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
23795         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
23796         return ret_conv;
23797 }
23798
23799 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
23800         if (!ptr_is_owned(_res)) return;
23801         void* _res_ptr = untag_ptr(_res);
23802         CHECK_ACCESS(_res_ptr);
23803         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
23804         FREE(untag_ptr(_res));
23805         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
23806 }
23807
23808 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
23809         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23810         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
23811         return tag_ptr(ret_conv, true);
23812 }
23813 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
23814         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
23815         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
23816         return ret_conv;
23817 }
23818
23819 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
23820         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
23821         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23822         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
23823         return tag_ptr(ret_conv, true);
23824 }
23825
23826 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
23827         LDKChannelReestablish o_conv;
23828         o_conv.inner = untag_ptr(o);
23829         o_conv.is_owned = ptr_is_owned(o);
23830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23831         o_conv = ChannelReestablish_clone(&o_conv);
23832         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23833         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
23834         return tag_ptr(ret_conv, true);
23835 }
23836
23837 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
23838         void* e_ptr = untag_ptr(e);
23839         CHECK_ACCESS(e_ptr);
23840         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23841         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23842         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23843         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
23844         return tag_ptr(ret_conv, true);
23845 }
23846
23847 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
23848         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
23849         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
23850         return ret_conv;
23851 }
23852
23853 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
23854         if (!ptr_is_owned(_res)) return;
23855         void* _res_ptr = untag_ptr(_res);
23856         CHECK_ACCESS(_res_ptr);
23857         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
23858         FREE(untag_ptr(_res));
23859         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
23860 }
23861
23862 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
23863         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23864         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
23865         return tag_ptr(ret_conv, true);
23866 }
23867 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
23868         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
23869         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
23870         return ret_conv;
23871 }
23872
23873 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
23874         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
23875         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23876         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
23877         return tag_ptr(ret_conv, true);
23878 }
23879
23880 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
23881         LDKClosingSigned o_conv;
23882         o_conv.inner = untag_ptr(o);
23883         o_conv.is_owned = ptr_is_owned(o);
23884         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23885         o_conv = ClosingSigned_clone(&o_conv);
23886         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23887         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
23888         return tag_ptr(ret_conv, true);
23889 }
23890
23891 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
23892         void* e_ptr = untag_ptr(e);
23893         CHECK_ACCESS(e_ptr);
23894         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23895         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23896         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23897         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
23898         return tag_ptr(ret_conv, true);
23899 }
23900
23901 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
23902         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
23903         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
23904         return ret_conv;
23905 }
23906
23907 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
23908         if (!ptr_is_owned(_res)) return;
23909         void* _res_ptr = untag_ptr(_res);
23910         CHECK_ACCESS(_res_ptr);
23911         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
23912         FREE(untag_ptr(_res));
23913         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
23914 }
23915
23916 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
23917         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23918         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
23919         return tag_ptr(ret_conv, true);
23920 }
23921 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
23922         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
23923         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
23924         return ret_conv;
23925 }
23926
23927 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
23928         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
23929         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23930         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
23931         return tag_ptr(ret_conv, true);
23932 }
23933
23934 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
23935         LDKClosingSignedFeeRange o_conv;
23936         o_conv.inner = untag_ptr(o);
23937         o_conv.is_owned = ptr_is_owned(o);
23938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23939         o_conv = ClosingSignedFeeRange_clone(&o_conv);
23940         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23941         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
23942         return tag_ptr(ret_conv, true);
23943 }
23944
23945 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
23946         void* e_ptr = untag_ptr(e);
23947         CHECK_ACCESS(e_ptr);
23948         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23949         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23950         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23951         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
23952         return tag_ptr(ret_conv, true);
23953 }
23954
23955 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
23956         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
23957         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
23958         return ret_conv;
23959 }
23960
23961 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
23962         if (!ptr_is_owned(_res)) return;
23963         void* _res_ptr = untag_ptr(_res);
23964         CHECK_ACCESS(_res_ptr);
23965         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
23966         FREE(untag_ptr(_res));
23967         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
23968 }
23969
23970 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
23971         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23972         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
23973         return tag_ptr(ret_conv, true);
23974 }
23975 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
23976         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
23977         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
23978         return ret_conv;
23979 }
23980
23981 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
23982         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
23983         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23984         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
23985         return tag_ptr(ret_conv, true);
23986 }
23987
23988 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
23989         LDKCommitmentSigned o_conv;
23990         o_conv.inner = untag_ptr(o);
23991         o_conv.is_owned = ptr_is_owned(o);
23992         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23993         o_conv = CommitmentSigned_clone(&o_conv);
23994         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23995         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
23996         return tag_ptr(ret_conv, true);
23997 }
23998
23999 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
24000         void* e_ptr = untag_ptr(e);
24001         CHECK_ACCESS(e_ptr);
24002         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24003         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24004         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24005         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
24006         return tag_ptr(ret_conv, true);
24007 }
24008
24009 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
24010         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
24011         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
24012         return ret_conv;
24013 }
24014
24015 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
24016         if (!ptr_is_owned(_res)) return;
24017         void* _res_ptr = untag_ptr(_res);
24018         CHECK_ACCESS(_res_ptr);
24019         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
24020         FREE(untag_ptr(_res));
24021         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
24022 }
24023
24024 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
24025         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24026         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
24027         return tag_ptr(ret_conv, true);
24028 }
24029 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24030         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
24031         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
24032         return ret_conv;
24033 }
24034
24035 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
24036         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
24037         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24038         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
24039         return tag_ptr(ret_conv, true);
24040 }
24041
24042 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
24043         LDKFundingCreated o_conv;
24044         o_conv.inner = untag_ptr(o);
24045         o_conv.is_owned = ptr_is_owned(o);
24046         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24047         o_conv = FundingCreated_clone(&o_conv);
24048         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24049         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
24050         return tag_ptr(ret_conv, true);
24051 }
24052
24053 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
24054         void* e_ptr = untag_ptr(e);
24055         CHECK_ACCESS(e_ptr);
24056         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24057         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24058         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24059         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
24060         return tag_ptr(ret_conv, true);
24061 }
24062
24063 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
24064         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
24065         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
24066         return ret_conv;
24067 }
24068
24069 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
24070         if (!ptr_is_owned(_res)) return;
24071         void* _res_ptr = untag_ptr(_res);
24072         CHECK_ACCESS(_res_ptr);
24073         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
24074         FREE(untag_ptr(_res));
24075         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
24076 }
24077
24078 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
24079         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24080         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
24081         return tag_ptr(ret_conv, true);
24082 }
24083 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
24084         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
24085         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
24086         return ret_conv;
24087 }
24088
24089 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
24090         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
24091         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24092         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
24093         return tag_ptr(ret_conv, true);
24094 }
24095
24096 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
24097         LDKFundingSigned o_conv;
24098         o_conv.inner = untag_ptr(o);
24099         o_conv.is_owned = ptr_is_owned(o);
24100         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24101         o_conv = FundingSigned_clone(&o_conv);
24102         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24103         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
24104         return tag_ptr(ret_conv, true);
24105 }
24106
24107 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
24108         void* e_ptr = untag_ptr(e);
24109         CHECK_ACCESS(e_ptr);
24110         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24111         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24112         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24113         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
24114         return tag_ptr(ret_conv, true);
24115 }
24116
24117 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
24118         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
24119         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
24120         return ret_conv;
24121 }
24122
24123 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
24124         if (!ptr_is_owned(_res)) return;
24125         void* _res_ptr = untag_ptr(_res);
24126         CHECK_ACCESS(_res_ptr);
24127         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
24128         FREE(untag_ptr(_res));
24129         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
24130 }
24131
24132 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
24133         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24134         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
24135         return tag_ptr(ret_conv, true);
24136 }
24137 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24138         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
24139         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
24140         return ret_conv;
24141 }
24142
24143 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
24144         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
24145         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24146         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
24147         return tag_ptr(ret_conv, true);
24148 }
24149
24150 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
24151         LDKChannelReady o_conv;
24152         o_conv.inner = untag_ptr(o);
24153         o_conv.is_owned = ptr_is_owned(o);
24154         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24155         o_conv = ChannelReady_clone(&o_conv);
24156         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24157         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
24158         return tag_ptr(ret_conv, true);
24159 }
24160
24161 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
24162         void* e_ptr = untag_ptr(e);
24163         CHECK_ACCESS(e_ptr);
24164         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24165         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24166         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24167         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
24168         return tag_ptr(ret_conv, true);
24169 }
24170
24171 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
24172         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
24173         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
24174         return ret_conv;
24175 }
24176
24177 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
24178         if (!ptr_is_owned(_res)) return;
24179         void* _res_ptr = untag_ptr(_res);
24180         CHECK_ACCESS(_res_ptr);
24181         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
24182         FREE(untag_ptr(_res));
24183         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
24184 }
24185
24186 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
24187         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24188         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
24189         return tag_ptr(ret_conv, true);
24190 }
24191 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
24192         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
24193         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
24194         return ret_conv;
24195 }
24196
24197 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
24198         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
24199         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24200         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
24201         return tag_ptr(ret_conv, true);
24202 }
24203
24204 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
24205         LDKInit o_conv;
24206         o_conv.inner = untag_ptr(o);
24207         o_conv.is_owned = ptr_is_owned(o);
24208         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24209         o_conv = Init_clone(&o_conv);
24210         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24211         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
24212         return tag_ptr(ret_conv, true);
24213 }
24214
24215 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
24216         void* e_ptr = untag_ptr(e);
24217         CHECK_ACCESS(e_ptr);
24218         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24219         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24220         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24221         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
24222         return tag_ptr(ret_conv, true);
24223 }
24224
24225 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
24226         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
24227         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
24228         return ret_conv;
24229 }
24230
24231 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
24232         if (!ptr_is_owned(_res)) return;
24233         void* _res_ptr = untag_ptr(_res);
24234         CHECK_ACCESS(_res_ptr);
24235         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
24236         FREE(untag_ptr(_res));
24237         CResult_InitDecodeErrorZ_free(_res_conv);
24238 }
24239
24240 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
24241         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24242         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
24243         return tag_ptr(ret_conv, true);
24244 }
24245 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
24246         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
24247         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
24248         return ret_conv;
24249 }
24250
24251 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
24252         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
24253         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24254         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
24255         return tag_ptr(ret_conv, true);
24256 }
24257
24258 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
24259         LDKOpenChannel o_conv;
24260         o_conv.inner = untag_ptr(o);
24261         o_conv.is_owned = ptr_is_owned(o);
24262         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24263         o_conv = OpenChannel_clone(&o_conv);
24264         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24265         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
24266         return tag_ptr(ret_conv, true);
24267 }
24268
24269 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
24270         void* e_ptr = untag_ptr(e);
24271         CHECK_ACCESS(e_ptr);
24272         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24273         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24274         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24275         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
24276         return tag_ptr(ret_conv, true);
24277 }
24278
24279 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
24280         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
24281         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
24282         return ret_conv;
24283 }
24284
24285 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
24286         if (!ptr_is_owned(_res)) return;
24287         void* _res_ptr = untag_ptr(_res);
24288         CHECK_ACCESS(_res_ptr);
24289         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
24290         FREE(untag_ptr(_res));
24291         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
24292 }
24293
24294 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
24295         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24296         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
24297         return tag_ptr(ret_conv, true);
24298 }
24299 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
24300         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
24301         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
24302         return ret_conv;
24303 }
24304
24305 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
24306         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
24307         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24308         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
24309         return tag_ptr(ret_conv, true);
24310 }
24311
24312 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
24313         LDKOpenChannelV2 o_conv;
24314         o_conv.inner = untag_ptr(o);
24315         o_conv.is_owned = ptr_is_owned(o);
24316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24317         o_conv = OpenChannelV2_clone(&o_conv);
24318         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24319         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
24320         return tag_ptr(ret_conv, true);
24321 }
24322
24323 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
24324         void* e_ptr = untag_ptr(e);
24325         CHECK_ACCESS(e_ptr);
24326         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24327         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24328         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24329         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
24330         return tag_ptr(ret_conv, true);
24331 }
24332
24333 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
24334         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
24335         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
24336         return ret_conv;
24337 }
24338
24339 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
24340         if (!ptr_is_owned(_res)) return;
24341         void* _res_ptr = untag_ptr(_res);
24342         CHECK_ACCESS(_res_ptr);
24343         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
24344         FREE(untag_ptr(_res));
24345         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
24346 }
24347
24348 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
24349         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24350         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
24351         return tag_ptr(ret_conv, true);
24352 }
24353 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
24354         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
24355         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
24356         return ret_conv;
24357 }
24358
24359 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
24360         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
24361         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24362         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
24363         return tag_ptr(ret_conv, true);
24364 }
24365
24366 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
24367         LDKRevokeAndACK o_conv;
24368         o_conv.inner = untag_ptr(o);
24369         o_conv.is_owned = ptr_is_owned(o);
24370         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24371         o_conv = RevokeAndACK_clone(&o_conv);
24372         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24373         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
24374         return tag_ptr(ret_conv, true);
24375 }
24376
24377 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
24378         void* e_ptr = untag_ptr(e);
24379         CHECK_ACCESS(e_ptr);
24380         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24381         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24382         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24383         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
24384         return tag_ptr(ret_conv, true);
24385 }
24386
24387 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
24388         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
24389         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
24390         return ret_conv;
24391 }
24392
24393 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
24394         if (!ptr_is_owned(_res)) return;
24395         void* _res_ptr = untag_ptr(_res);
24396         CHECK_ACCESS(_res_ptr);
24397         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
24398         FREE(untag_ptr(_res));
24399         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
24400 }
24401
24402 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
24403         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24404         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
24405         return tag_ptr(ret_conv, true);
24406 }
24407 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
24408         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
24409         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
24410         return ret_conv;
24411 }
24412
24413 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
24414         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
24415         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24416         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
24417         return tag_ptr(ret_conv, true);
24418 }
24419
24420 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
24421         LDKShutdown o_conv;
24422         o_conv.inner = untag_ptr(o);
24423         o_conv.is_owned = ptr_is_owned(o);
24424         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24425         o_conv = Shutdown_clone(&o_conv);
24426         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24427         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
24428         return tag_ptr(ret_conv, true);
24429 }
24430
24431 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
24432         void* e_ptr = untag_ptr(e);
24433         CHECK_ACCESS(e_ptr);
24434         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24435         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24436         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24437         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
24438         return tag_ptr(ret_conv, true);
24439 }
24440
24441 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
24442         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
24443         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
24444         return ret_conv;
24445 }
24446
24447 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
24448         if (!ptr_is_owned(_res)) return;
24449         void* _res_ptr = untag_ptr(_res);
24450         CHECK_ACCESS(_res_ptr);
24451         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
24452         FREE(untag_ptr(_res));
24453         CResult_ShutdownDecodeErrorZ_free(_res_conv);
24454 }
24455
24456 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
24457         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24458         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
24459         return tag_ptr(ret_conv, true);
24460 }
24461 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
24462         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
24463         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
24464         return ret_conv;
24465 }
24466
24467 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
24468         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
24469         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24470         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
24471         return tag_ptr(ret_conv, true);
24472 }
24473
24474 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
24475         LDKUpdateFailHTLC o_conv;
24476         o_conv.inner = untag_ptr(o);
24477         o_conv.is_owned = ptr_is_owned(o);
24478         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24479         o_conv = UpdateFailHTLC_clone(&o_conv);
24480         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24481         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
24482         return tag_ptr(ret_conv, true);
24483 }
24484
24485 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
24486         void* e_ptr = untag_ptr(e);
24487         CHECK_ACCESS(e_ptr);
24488         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24489         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24490         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24491         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
24492         return tag_ptr(ret_conv, true);
24493 }
24494
24495 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
24496         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
24497         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
24498         return ret_conv;
24499 }
24500
24501 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
24502         if (!ptr_is_owned(_res)) return;
24503         void* _res_ptr = untag_ptr(_res);
24504         CHECK_ACCESS(_res_ptr);
24505         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
24506         FREE(untag_ptr(_res));
24507         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
24508 }
24509
24510 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
24511         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24512         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
24513         return tag_ptr(ret_conv, true);
24514 }
24515 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24516         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
24517         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
24518         return ret_conv;
24519 }
24520
24521 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
24522         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
24523         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24524         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
24525         return tag_ptr(ret_conv, true);
24526 }
24527
24528 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
24529         LDKUpdateFailMalformedHTLC o_conv;
24530         o_conv.inner = untag_ptr(o);
24531         o_conv.is_owned = ptr_is_owned(o);
24532         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24533         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
24534         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24535         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
24536         return tag_ptr(ret_conv, true);
24537 }
24538
24539 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
24540         void* e_ptr = untag_ptr(e);
24541         CHECK_ACCESS(e_ptr);
24542         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24543         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24544         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24545         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
24546         return tag_ptr(ret_conv, true);
24547 }
24548
24549 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
24550         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
24551         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
24552         return ret_conv;
24553 }
24554
24555 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
24556         if (!ptr_is_owned(_res)) return;
24557         void* _res_ptr = untag_ptr(_res);
24558         CHECK_ACCESS(_res_ptr);
24559         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
24560         FREE(untag_ptr(_res));
24561         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
24562 }
24563
24564 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
24565         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24566         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
24567         return tag_ptr(ret_conv, true);
24568 }
24569 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24570         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
24571         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
24572         return ret_conv;
24573 }
24574
24575 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
24576         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
24577         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24578         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
24579         return tag_ptr(ret_conv, true);
24580 }
24581
24582 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
24583         LDKUpdateFee o_conv;
24584         o_conv.inner = untag_ptr(o);
24585         o_conv.is_owned = ptr_is_owned(o);
24586         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24587         o_conv = UpdateFee_clone(&o_conv);
24588         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24589         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
24590         return tag_ptr(ret_conv, true);
24591 }
24592
24593 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
24594         void* e_ptr = untag_ptr(e);
24595         CHECK_ACCESS(e_ptr);
24596         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24597         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24598         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24599         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
24600         return tag_ptr(ret_conv, true);
24601 }
24602
24603 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
24604         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
24605         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
24606         return ret_conv;
24607 }
24608
24609 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
24610         if (!ptr_is_owned(_res)) return;
24611         void* _res_ptr = untag_ptr(_res);
24612         CHECK_ACCESS(_res_ptr);
24613         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
24614         FREE(untag_ptr(_res));
24615         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
24616 }
24617
24618 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
24619         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24620         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
24621         return tag_ptr(ret_conv, true);
24622 }
24623 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
24624         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
24625         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
24626         return ret_conv;
24627 }
24628
24629 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
24630         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
24631         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24632         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
24633         return tag_ptr(ret_conv, true);
24634 }
24635
24636 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
24637         LDKUpdateFulfillHTLC o_conv;
24638         o_conv.inner = untag_ptr(o);
24639         o_conv.is_owned = ptr_is_owned(o);
24640         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24641         o_conv = UpdateFulfillHTLC_clone(&o_conv);
24642         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24643         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
24644         return tag_ptr(ret_conv, true);
24645 }
24646
24647 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
24648         void* e_ptr = untag_ptr(e);
24649         CHECK_ACCESS(e_ptr);
24650         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24651         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24652         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24653         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
24654         return tag_ptr(ret_conv, true);
24655 }
24656
24657 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
24658         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
24659         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
24660         return ret_conv;
24661 }
24662
24663 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
24664         if (!ptr_is_owned(_res)) return;
24665         void* _res_ptr = untag_ptr(_res);
24666         CHECK_ACCESS(_res_ptr);
24667         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
24668         FREE(untag_ptr(_res));
24669         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
24670 }
24671
24672 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
24673         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24674         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
24675         return tag_ptr(ret_conv, true);
24676 }
24677 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24678         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
24679         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
24680         return ret_conv;
24681 }
24682
24683 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
24684         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
24685         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24686         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
24687         return tag_ptr(ret_conv, true);
24688 }
24689
24690 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
24691         LDKUpdateAddHTLC o_conv;
24692         o_conv.inner = untag_ptr(o);
24693         o_conv.is_owned = ptr_is_owned(o);
24694         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24695         o_conv = UpdateAddHTLC_clone(&o_conv);
24696         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24697         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
24698         return tag_ptr(ret_conv, true);
24699 }
24700
24701 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
24702         void* e_ptr = untag_ptr(e);
24703         CHECK_ACCESS(e_ptr);
24704         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24705         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24706         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24707         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
24708         return tag_ptr(ret_conv, true);
24709 }
24710
24711 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
24712         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
24713         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
24714         return ret_conv;
24715 }
24716
24717 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
24718         if (!ptr_is_owned(_res)) return;
24719         void* _res_ptr = untag_ptr(_res);
24720         CHECK_ACCESS(_res_ptr);
24721         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
24722         FREE(untag_ptr(_res));
24723         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
24724 }
24725
24726 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
24727         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24728         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
24729         return tag_ptr(ret_conv, true);
24730 }
24731 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24732         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
24733         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
24734         return ret_conv;
24735 }
24736
24737 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
24738         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
24739         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24740         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
24741         return tag_ptr(ret_conv, true);
24742 }
24743
24744 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
24745         LDKOnionMessage o_conv;
24746         o_conv.inner = untag_ptr(o);
24747         o_conv.is_owned = ptr_is_owned(o);
24748         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24749         o_conv = OnionMessage_clone(&o_conv);
24750         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
24751         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
24752         return tag_ptr(ret_conv, true);
24753 }
24754
24755 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
24756         void* e_ptr = untag_ptr(e);
24757         CHECK_ACCESS(e_ptr);
24758         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24759         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24760         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
24761         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
24762         return tag_ptr(ret_conv, true);
24763 }
24764
24765 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
24766         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
24767         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
24768         return ret_conv;
24769 }
24770
24771 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
24772         if (!ptr_is_owned(_res)) return;
24773         void* _res_ptr = untag_ptr(_res);
24774         CHECK_ACCESS(_res_ptr);
24775         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
24776         FREE(untag_ptr(_res));
24777         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
24778 }
24779
24780 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
24781         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
24782         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
24783         return tag_ptr(ret_conv, true);
24784 }
24785 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
24786         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
24787         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
24788         return ret_conv;
24789 }
24790
24791 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
24792         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
24793         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
24794         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
24795         return tag_ptr(ret_conv, true);
24796 }
24797
24798 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
24799         LDKPing o_conv;
24800         o_conv.inner = untag_ptr(o);
24801         o_conv.is_owned = ptr_is_owned(o);
24802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24803         o_conv = Ping_clone(&o_conv);
24804         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24805         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
24806         return tag_ptr(ret_conv, true);
24807 }
24808
24809 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
24810         void* e_ptr = untag_ptr(e);
24811         CHECK_ACCESS(e_ptr);
24812         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24813         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24814         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24815         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
24816         return tag_ptr(ret_conv, true);
24817 }
24818
24819 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
24820         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
24821         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
24822         return ret_conv;
24823 }
24824
24825 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
24826         if (!ptr_is_owned(_res)) return;
24827         void* _res_ptr = untag_ptr(_res);
24828         CHECK_ACCESS(_res_ptr);
24829         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
24830         FREE(untag_ptr(_res));
24831         CResult_PingDecodeErrorZ_free(_res_conv);
24832 }
24833
24834 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
24835         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24836         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
24837         return tag_ptr(ret_conv, true);
24838 }
24839 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
24840         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
24841         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
24842         return ret_conv;
24843 }
24844
24845 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
24846         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
24847         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24848         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
24849         return tag_ptr(ret_conv, true);
24850 }
24851
24852 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
24853         LDKPong o_conv;
24854         o_conv.inner = untag_ptr(o);
24855         o_conv.is_owned = ptr_is_owned(o);
24856         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24857         o_conv = Pong_clone(&o_conv);
24858         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24859         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
24860         return tag_ptr(ret_conv, true);
24861 }
24862
24863 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
24864         void* e_ptr = untag_ptr(e);
24865         CHECK_ACCESS(e_ptr);
24866         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24867         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24868         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24869         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
24870         return tag_ptr(ret_conv, true);
24871 }
24872
24873 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
24874         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
24875         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
24876         return ret_conv;
24877 }
24878
24879 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
24880         if (!ptr_is_owned(_res)) return;
24881         void* _res_ptr = untag_ptr(_res);
24882         CHECK_ACCESS(_res_ptr);
24883         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
24884         FREE(untag_ptr(_res));
24885         CResult_PongDecodeErrorZ_free(_res_conv);
24886 }
24887
24888 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
24889         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24890         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
24891         return tag_ptr(ret_conv, true);
24892 }
24893 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
24894         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
24895         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
24896         return ret_conv;
24897 }
24898
24899 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
24900         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
24901         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24902         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
24903         return tag_ptr(ret_conv, true);
24904 }
24905
24906 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
24907         LDKUnsignedChannelAnnouncement o_conv;
24908         o_conv.inner = untag_ptr(o);
24909         o_conv.is_owned = ptr_is_owned(o);
24910         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24911         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
24912         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24913         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
24914         return tag_ptr(ret_conv, true);
24915 }
24916
24917 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
24918         void* e_ptr = untag_ptr(e);
24919         CHECK_ACCESS(e_ptr);
24920         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24921         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24922         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24923         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
24924         return tag_ptr(ret_conv, true);
24925 }
24926
24927 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
24928         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
24929         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
24930         return ret_conv;
24931 }
24932
24933 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
24934         if (!ptr_is_owned(_res)) return;
24935         void* _res_ptr = untag_ptr(_res);
24936         CHECK_ACCESS(_res_ptr);
24937         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
24938         FREE(untag_ptr(_res));
24939         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
24940 }
24941
24942 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
24943         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24944         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
24945         return tag_ptr(ret_conv, true);
24946 }
24947 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
24948         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
24949         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
24950         return ret_conv;
24951 }
24952
24953 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
24954         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
24955         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24956         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
24957         return tag_ptr(ret_conv, true);
24958 }
24959
24960 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
24961         LDKChannelAnnouncement o_conv;
24962         o_conv.inner = untag_ptr(o);
24963         o_conv.is_owned = ptr_is_owned(o);
24964         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24965         o_conv = ChannelAnnouncement_clone(&o_conv);
24966         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24967         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
24968         return tag_ptr(ret_conv, true);
24969 }
24970
24971 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
24972         void* e_ptr = untag_ptr(e);
24973         CHECK_ACCESS(e_ptr);
24974         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24975         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24976         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24977         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
24978         return tag_ptr(ret_conv, true);
24979 }
24980
24981 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
24982         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
24983         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
24984         return ret_conv;
24985 }
24986
24987 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
24988         if (!ptr_is_owned(_res)) return;
24989         void* _res_ptr = untag_ptr(_res);
24990         CHECK_ACCESS(_res_ptr);
24991         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
24992         FREE(untag_ptr(_res));
24993         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
24994 }
24995
24996 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
24997         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24998         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
24999         return tag_ptr(ret_conv, true);
25000 }
25001 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25002         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25003         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25004         return ret_conv;
25005 }
25006
25007 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25008         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25009         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25010         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25011         return tag_ptr(ret_conv, true);
25012 }
25013
25014 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25015         LDKUnsignedChannelUpdate o_conv;
25016         o_conv.inner = untag_ptr(o);
25017         o_conv.is_owned = ptr_is_owned(o);
25018         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25019         o_conv = UnsignedChannelUpdate_clone(&o_conv);
25020         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25021         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
25022         return tag_ptr(ret_conv, true);
25023 }
25024
25025 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
25026         void* e_ptr = untag_ptr(e);
25027         CHECK_ACCESS(e_ptr);
25028         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25029         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25030         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25031         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
25032         return tag_ptr(ret_conv, true);
25033 }
25034
25035 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25036         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
25037         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
25038         return ret_conv;
25039 }
25040
25041 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25042         if (!ptr_is_owned(_res)) return;
25043         void* _res_ptr = untag_ptr(_res);
25044         CHECK_ACCESS(_res_ptr);
25045         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
25046         FREE(untag_ptr(_res));
25047         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
25048 }
25049
25050 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25051         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25052         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
25053         return tag_ptr(ret_conv, true);
25054 }
25055 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25056         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25057         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25058         return ret_conv;
25059 }
25060
25061 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25062         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25063         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25064         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
25065         return tag_ptr(ret_conv, true);
25066 }
25067
25068 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25069         LDKChannelUpdate o_conv;
25070         o_conv.inner = untag_ptr(o);
25071         o_conv.is_owned = ptr_is_owned(o);
25072         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25073         o_conv = ChannelUpdate_clone(&o_conv);
25074         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25075         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
25076         return tag_ptr(ret_conv, true);
25077 }
25078
25079 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
25080         void* e_ptr = untag_ptr(e);
25081         CHECK_ACCESS(e_ptr);
25082         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25083         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25084         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25085         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
25086         return tag_ptr(ret_conv, true);
25087 }
25088
25089 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25090         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
25091         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
25092         return ret_conv;
25093 }
25094
25095 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25096         if (!ptr_is_owned(_res)) return;
25097         void* _res_ptr = untag_ptr(_res);
25098         CHECK_ACCESS(_res_ptr);
25099         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
25100         FREE(untag_ptr(_res));
25101         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
25102 }
25103
25104 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25105         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25106         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
25107         return tag_ptr(ret_conv, true);
25108 }
25109 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25110         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25111         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25112         return ret_conv;
25113 }
25114
25115 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25116         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25117         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25118         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
25119         return tag_ptr(ret_conv, true);
25120 }
25121
25122 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
25123         LDKErrorMessage o_conv;
25124         o_conv.inner = untag_ptr(o);
25125         o_conv.is_owned = ptr_is_owned(o);
25126         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25127         o_conv = ErrorMessage_clone(&o_conv);
25128         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25129         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
25130         return tag_ptr(ret_conv, true);
25131 }
25132
25133 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
25134         void* e_ptr = untag_ptr(e);
25135         CHECK_ACCESS(e_ptr);
25136         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25137         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25138         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25139         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
25140         return tag_ptr(ret_conv, true);
25141 }
25142
25143 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
25144         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
25145         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
25146         return ret_conv;
25147 }
25148
25149 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
25150         if (!ptr_is_owned(_res)) return;
25151         void* _res_ptr = untag_ptr(_res);
25152         CHECK_ACCESS(_res_ptr);
25153         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
25154         FREE(untag_ptr(_res));
25155         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
25156 }
25157
25158 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
25159         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25160         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
25161         return tag_ptr(ret_conv, true);
25162 }
25163 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25164         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
25165         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
25166         return ret_conv;
25167 }
25168
25169 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
25170         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
25171         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25172         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
25173         return tag_ptr(ret_conv, true);
25174 }
25175
25176 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
25177         LDKWarningMessage o_conv;
25178         o_conv.inner = untag_ptr(o);
25179         o_conv.is_owned = ptr_is_owned(o);
25180         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25181         o_conv = WarningMessage_clone(&o_conv);
25182         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25183         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
25184         return tag_ptr(ret_conv, true);
25185 }
25186
25187 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
25188         void* e_ptr = untag_ptr(e);
25189         CHECK_ACCESS(e_ptr);
25190         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25191         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25192         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25193         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
25194         return tag_ptr(ret_conv, true);
25195 }
25196
25197 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
25198         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
25199         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
25200         return ret_conv;
25201 }
25202
25203 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
25204         if (!ptr_is_owned(_res)) return;
25205         void* _res_ptr = untag_ptr(_res);
25206         CHECK_ACCESS(_res_ptr);
25207         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
25208         FREE(untag_ptr(_res));
25209         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
25210 }
25211
25212 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
25213         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25214         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
25215         return tag_ptr(ret_conv, true);
25216 }
25217 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25218         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
25219         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
25220         return ret_conv;
25221 }
25222
25223 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
25224         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
25225         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25226         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
25227         return tag_ptr(ret_conv, true);
25228 }
25229
25230 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
25231         LDKUnsignedNodeAnnouncement o_conv;
25232         o_conv.inner = untag_ptr(o);
25233         o_conv.is_owned = ptr_is_owned(o);
25234         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25235         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
25236         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25237         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
25238         return tag_ptr(ret_conv, true);
25239 }
25240
25241 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
25242         void* e_ptr = untag_ptr(e);
25243         CHECK_ACCESS(e_ptr);
25244         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25245         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25246         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25247         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
25248         return tag_ptr(ret_conv, true);
25249 }
25250
25251 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25252         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25253         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25254         return ret_conv;
25255 }
25256
25257 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
25258         if (!ptr_is_owned(_res)) return;
25259         void* _res_ptr = untag_ptr(_res);
25260         CHECK_ACCESS(_res_ptr);
25261         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
25262         FREE(untag_ptr(_res));
25263         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
25264 }
25265
25266 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25267         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25268         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
25269         return tag_ptr(ret_conv, true);
25270 }
25271 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25272         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25273         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25274         return ret_conv;
25275 }
25276
25277 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25278         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25279         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25280         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
25281         return tag_ptr(ret_conv, true);
25282 }
25283
25284 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
25285         LDKNodeAnnouncement o_conv;
25286         o_conv.inner = untag_ptr(o);
25287         o_conv.is_owned = ptr_is_owned(o);
25288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25289         o_conv = NodeAnnouncement_clone(&o_conv);
25290         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25291         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
25292         return tag_ptr(ret_conv, true);
25293 }
25294
25295 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
25296         void* e_ptr = untag_ptr(e);
25297         CHECK_ACCESS(e_ptr);
25298         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25299         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25300         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25301         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
25302         return tag_ptr(ret_conv, true);
25303 }
25304
25305 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25306         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25307         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25308         return ret_conv;
25309 }
25310
25311 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
25312         if (!ptr_is_owned(_res)) return;
25313         void* _res_ptr = untag_ptr(_res);
25314         CHECK_ACCESS(_res_ptr);
25315         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
25316         FREE(untag_ptr(_res));
25317         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
25318 }
25319
25320 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25321         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25322         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
25323         return tag_ptr(ret_conv, true);
25324 }
25325 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25326         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25327         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25328         return ret_conv;
25329 }
25330
25331 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25332         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25333         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25334         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
25335         return tag_ptr(ret_conv, true);
25336 }
25337
25338 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
25339         LDKQueryShortChannelIds o_conv;
25340         o_conv.inner = untag_ptr(o);
25341         o_conv.is_owned = ptr_is_owned(o);
25342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25343         o_conv = QueryShortChannelIds_clone(&o_conv);
25344         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25345         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
25346         return tag_ptr(ret_conv, true);
25347 }
25348
25349 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
25350         void* e_ptr = untag_ptr(e);
25351         CHECK_ACCESS(e_ptr);
25352         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25353         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25354         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25355         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
25356         return tag_ptr(ret_conv, true);
25357 }
25358
25359 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
25360         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
25361         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
25362         return ret_conv;
25363 }
25364
25365 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
25366         if (!ptr_is_owned(_res)) return;
25367         void* _res_ptr = untag_ptr(_res);
25368         CHECK_ACCESS(_res_ptr);
25369         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
25370         FREE(untag_ptr(_res));
25371         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
25372 }
25373
25374 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
25375         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25376         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
25377         return tag_ptr(ret_conv, true);
25378 }
25379 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
25380         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
25381         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
25382         return ret_conv;
25383 }
25384
25385 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
25386         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
25387         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25388         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
25389         return tag_ptr(ret_conv, true);
25390 }
25391
25392 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
25393         LDKReplyShortChannelIdsEnd o_conv;
25394         o_conv.inner = untag_ptr(o);
25395         o_conv.is_owned = ptr_is_owned(o);
25396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25397         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
25398         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25399         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
25400         return tag_ptr(ret_conv, true);
25401 }
25402
25403 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
25404         void* e_ptr = untag_ptr(e);
25405         CHECK_ACCESS(e_ptr);
25406         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25407         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25408         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25409         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
25410         return tag_ptr(ret_conv, true);
25411 }
25412
25413 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
25414         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
25415         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
25416         return ret_conv;
25417 }
25418
25419 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
25420         if (!ptr_is_owned(_res)) return;
25421         void* _res_ptr = untag_ptr(_res);
25422         CHECK_ACCESS(_res_ptr);
25423         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
25424         FREE(untag_ptr(_res));
25425         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
25426 }
25427
25428 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
25429         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25430         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
25431         return tag_ptr(ret_conv, true);
25432 }
25433 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
25434         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
25435         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
25436         return ret_conv;
25437 }
25438
25439 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
25440         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
25441         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25442         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
25443         return tag_ptr(ret_conv, true);
25444 }
25445
25446 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
25447         LDKQueryChannelRange o_conv;
25448         o_conv.inner = untag_ptr(o);
25449         o_conv.is_owned = ptr_is_owned(o);
25450         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25451         o_conv = QueryChannelRange_clone(&o_conv);
25452         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25453         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
25454         return tag_ptr(ret_conv, true);
25455 }
25456
25457 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
25458         void* e_ptr = untag_ptr(e);
25459         CHECK_ACCESS(e_ptr);
25460         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25461         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25462         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25463         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
25464         return tag_ptr(ret_conv, true);
25465 }
25466
25467 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
25468         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
25469         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
25470         return ret_conv;
25471 }
25472
25473 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
25474         if (!ptr_is_owned(_res)) return;
25475         void* _res_ptr = untag_ptr(_res);
25476         CHECK_ACCESS(_res_ptr);
25477         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
25478         FREE(untag_ptr(_res));
25479         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
25480 }
25481
25482 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
25483         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25484         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
25485         return tag_ptr(ret_conv, true);
25486 }
25487 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
25488         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
25489         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
25490         return ret_conv;
25491 }
25492
25493 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
25494         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
25495         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25496         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
25497         return tag_ptr(ret_conv, true);
25498 }
25499
25500 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
25501         LDKReplyChannelRange o_conv;
25502         o_conv.inner = untag_ptr(o);
25503         o_conv.is_owned = ptr_is_owned(o);
25504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25505         o_conv = ReplyChannelRange_clone(&o_conv);
25506         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25507         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
25508         return tag_ptr(ret_conv, true);
25509 }
25510
25511 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
25512         void* e_ptr = untag_ptr(e);
25513         CHECK_ACCESS(e_ptr);
25514         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25515         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25516         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25517         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
25518         return tag_ptr(ret_conv, true);
25519 }
25520
25521 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
25522         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
25523         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
25524         return ret_conv;
25525 }
25526
25527 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
25528         if (!ptr_is_owned(_res)) return;
25529         void* _res_ptr = untag_ptr(_res);
25530         CHECK_ACCESS(_res_ptr);
25531         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
25532         FREE(untag_ptr(_res));
25533         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
25534 }
25535
25536 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
25537         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25538         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
25539         return tag_ptr(ret_conv, true);
25540 }
25541 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
25542         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
25543         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
25544         return ret_conv;
25545 }
25546
25547 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
25548         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
25549         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25550         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
25551         return tag_ptr(ret_conv, true);
25552 }
25553
25554 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
25555         LDKGossipTimestampFilter o_conv;
25556         o_conv.inner = untag_ptr(o);
25557         o_conv.is_owned = ptr_is_owned(o);
25558         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25559         o_conv = GossipTimestampFilter_clone(&o_conv);
25560         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25561         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
25562         return tag_ptr(ret_conv, true);
25563 }
25564
25565 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
25566         void* e_ptr = untag_ptr(e);
25567         CHECK_ACCESS(e_ptr);
25568         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25569         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25570         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25571         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
25572         return tag_ptr(ret_conv, true);
25573 }
25574
25575 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
25576         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
25577         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
25578         return ret_conv;
25579 }
25580
25581 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
25582         if (!ptr_is_owned(_res)) return;
25583         void* _res_ptr = untag_ptr(_res);
25584         CHECK_ACCESS(_res_ptr);
25585         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
25586         FREE(untag_ptr(_res));
25587         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
25588 }
25589
25590 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
25591         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25592         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
25593         return tag_ptr(ret_conv, true);
25594 }
25595 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
25596         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
25597         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
25598         return ret_conv;
25599 }
25600
25601 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
25602         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
25603         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25604         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
25605         return tag_ptr(ret_conv, true);
25606 }
25607
25608 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
25609         LDKCVec_PhantomRouteHintsZ _res_constr;
25610         _res_constr.datalen = _res->arr_len;
25611         if (_res_constr.datalen > 0)
25612                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
25613         else
25614                 _res_constr.data = NULL;
25615         uint64_t* _res_vals = _res->elems;
25616         for (size_t t = 0; t < _res_constr.datalen; t++) {
25617                 uint64_t _res_conv_19 = _res_vals[t];
25618                 LDKPhantomRouteHints _res_conv_19_conv;
25619                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
25620                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
25621                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
25622                 _res_constr.data[t] = _res_conv_19_conv;
25623         }
25624         FREE(_res);
25625         CVec_PhantomRouteHintsZ_free(_res_constr);
25626 }
25627
25628 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
25629         LDKBolt11Invoice o_conv;
25630         o_conv.inner = untag_ptr(o);
25631         o_conv.is_owned = ptr_is_owned(o);
25632         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25633         o_conv = Bolt11Invoice_clone(&o_conv);
25634         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
25635         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
25636         return tag_ptr(ret_conv, true);
25637 }
25638
25639 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
25640         void* e_ptr = untag_ptr(e);
25641         CHECK_ACCESS(e_ptr);
25642         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
25643         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
25644         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
25645         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
25646         return tag_ptr(ret_conv, true);
25647 }
25648
25649 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
25650         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
25651         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
25652         return ret_conv;
25653 }
25654
25655 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
25656         if (!ptr_is_owned(_res)) return;
25657         void* _res_ptr = untag_ptr(_res);
25658         CHECK_ACCESS(_res_ptr);
25659         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
25660         FREE(untag_ptr(_res));
25661         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
25662 }
25663
25664 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
25665         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
25666         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
25667         return tag_ptr(ret_conv, true);
25668 }
25669 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
25670         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
25671         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
25672         return ret_conv;
25673 }
25674
25675 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
25676         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
25677         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
25678         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
25679         return tag_ptr(ret_conv, true);
25680 }
25681
25682 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
25683         void* o_ptr = untag_ptr(o);
25684         CHECK_ACCESS(o_ptr);
25685         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
25686         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
25687         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
25688         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
25689         return tag_ptr(ret_conv, true);
25690 }
25691
25692 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
25693         void* e_ptr = untag_ptr(e);
25694         CHECK_ACCESS(e_ptr);
25695         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25696         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25697         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
25698         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
25699         return tag_ptr(ret_conv, true);
25700 }
25701
25702 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
25703         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
25704         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
25705         return ret_conv;
25706 }
25707
25708 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
25709         if (!ptr_is_owned(_res)) return;
25710         void* _res_ptr = untag_ptr(_res);
25711         CHECK_ACCESS(_res_ptr);
25712         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
25713         FREE(untag_ptr(_res));
25714         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
25715 }
25716
25717 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
25718         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
25719         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
25720         return tag_ptr(ret_conv, true);
25721 }
25722 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25723         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
25724         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
25725         return ret_conv;
25726 }
25727
25728 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
25729         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
25730         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
25731         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
25732         return tag_ptr(ret_conv, true);
25733 }
25734
25735 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
25736         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
25737         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
25738         *ret_copy = COption_HTLCClaimZ_some(o_conv);
25739         uint64_t ret_ref = tag_ptr(ret_copy, true);
25740         return ret_ref;
25741 }
25742
25743 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
25744         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
25745         *ret_copy = COption_HTLCClaimZ_none();
25746         uint64_t ret_ref = tag_ptr(ret_copy, true);
25747         return ret_ref;
25748 }
25749
25750 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
25751         if (!ptr_is_owned(_res)) return;
25752         void* _res_ptr = untag_ptr(_res);
25753         CHECK_ACCESS(_res_ptr);
25754         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
25755         FREE(untag_ptr(_res));
25756         COption_HTLCClaimZ_free(_res_conv);
25757 }
25758
25759 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
25760         LDKCounterpartyCommitmentSecrets o_conv;
25761         o_conv.inner = untag_ptr(o);
25762         o_conv.is_owned = ptr_is_owned(o);
25763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25764         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
25765         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
25766         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
25767         return tag_ptr(ret_conv, true);
25768 }
25769
25770 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
25771         void* e_ptr = untag_ptr(e);
25772         CHECK_ACCESS(e_ptr);
25773         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25774         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25775         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
25776         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
25777         return tag_ptr(ret_conv, true);
25778 }
25779
25780 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
25781         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
25782         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
25783         return ret_conv;
25784 }
25785
25786 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
25787         if (!ptr_is_owned(_res)) return;
25788         void* _res_ptr = untag_ptr(_res);
25789         CHECK_ACCESS(_res_ptr);
25790         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
25791         FREE(untag_ptr(_res));
25792         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
25793 }
25794
25795 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
25796         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
25797         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
25798         return tag_ptr(ret_conv, true);
25799 }
25800 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
25801         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
25802         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
25803         return ret_conv;
25804 }
25805
25806 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
25807         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
25808         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
25809         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
25810         return tag_ptr(ret_conv, true);
25811 }
25812
25813 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
25814         LDKTxCreationKeys o_conv;
25815         o_conv.inner = untag_ptr(o);
25816         o_conv.is_owned = ptr_is_owned(o);
25817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25818         o_conv = TxCreationKeys_clone(&o_conv);
25819         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25820         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
25821         return tag_ptr(ret_conv, true);
25822 }
25823
25824 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
25825         void* e_ptr = untag_ptr(e);
25826         CHECK_ACCESS(e_ptr);
25827         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25828         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25829         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25830         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
25831         return tag_ptr(ret_conv, true);
25832 }
25833
25834 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
25835         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
25836         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
25837         return ret_conv;
25838 }
25839
25840 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
25841         if (!ptr_is_owned(_res)) return;
25842         void* _res_ptr = untag_ptr(_res);
25843         CHECK_ACCESS(_res_ptr);
25844         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
25845         FREE(untag_ptr(_res));
25846         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
25847 }
25848
25849 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
25850         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25851         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
25852         return tag_ptr(ret_conv, true);
25853 }
25854 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
25855         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
25856         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
25857         return ret_conv;
25858 }
25859
25860 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
25861         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
25862         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25863         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
25864         return tag_ptr(ret_conv, true);
25865 }
25866
25867 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
25868         LDKChannelPublicKeys o_conv;
25869         o_conv.inner = untag_ptr(o);
25870         o_conv.is_owned = ptr_is_owned(o);
25871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25872         o_conv = ChannelPublicKeys_clone(&o_conv);
25873         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25874         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
25875         return tag_ptr(ret_conv, true);
25876 }
25877
25878 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
25879         void* e_ptr = untag_ptr(e);
25880         CHECK_ACCESS(e_ptr);
25881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25883         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25884         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
25885         return tag_ptr(ret_conv, true);
25886 }
25887
25888 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
25889         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
25890         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
25891         return ret_conv;
25892 }
25893
25894 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
25895         if (!ptr_is_owned(_res)) return;
25896         void* _res_ptr = untag_ptr(_res);
25897         CHECK_ACCESS(_res_ptr);
25898         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
25899         FREE(untag_ptr(_res));
25900         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
25901 }
25902
25903 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
25904         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25905         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
25906         return tag_ptr(ret_conv, true);
25907 }
25908 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
25909         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
25910         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
25911         return ret_conv;
25912 }
25913
25914 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
25915         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
25916         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25917         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
25918         return tag_ptr(ret_conv, true);
25919 }
25920
25921 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
25922         LDKHTLCOutputInCommitment o_conv;
25923         o_conv.inner = untag_ptr(o);
25924         o_conv.is_owned = ptr_is_owned(o);
25925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25926         o_conv = HTLCOutputInCommitment_clone(&o_conv);
25927         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25928         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
25929         return tag_ptr(ret_conv, true);
25930 }
25931
25932 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
25933         void* e_ptr = untag_ptr(e);
25934         CHECK_ACCESS(e_ptr);
25935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25937         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25938         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
25939         return tag_ptr(ret_conv, true);
25940 }
25941
25942 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
25943         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
25944         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
25945         return ret_conv;
25946 }
25947
25948 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
25949         if (!ptr_is_owned(_res)) return;
25950         void* _res_ptr = untag_ptr(_res);
25951         CHECK_ACCESS(_res_ptr);
25952         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
25953         FREE(untag_ptr(_res));
25954         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
25955 }
25956
25957 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
25958         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25959         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
25960         return tag_ptr(ret_conv, true);
25961 }
25962 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
25963         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
25964         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
25965         return ret_conv;
25966 }
25967
25968 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
25969         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
25970         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25971         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
25972         return tag_ptr(ret_conv, true);
25973 }
25974
25975 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
25976         LDKCounterpartyChannelTransactionParameters o_conv;
25977         o_conv.inner = untag_ptr(o);
25978         o_conv.is_owned = ptr_is_owned(o);
25979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25980         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
25981         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
25982         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
25983         return tag_ptr(ret_conv, true);
25984 }
25985
25986 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
25987         void* e_ptr = untag_ptr(e);
25988         CHECK_ACCESS(e_ptr);
25989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25991         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
25992         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
25993         return tag_ptr(ret_conv, true);
25994 }
25995
25996 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
25997         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
25998         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
25999         return ret_conv;
26000 }
26001
26002 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
26003         if (!ptr_is_owned(_res)) return;
26004         void* _res_ptr = untag_ptr(_res);
26005         CHECK_ACCESS(_res_ptr);
26006         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
26007         FREE(untag_ptr(_res));
26008         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
26009 }
26010
26011 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
26012         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26013         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
26014         return tag_ptr(ret_conv, true);
26015 }
26016 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
26017         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
26018         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
26019         return ret_conv;
26020 }
26021
26022 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
26023         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
26024         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26025         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
26026         return tag_ptr(ret_conv, true);
26027 }
26028
26029 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
26030         LDKChannelTransactionParameters o_conv;
26031         o_conv.inner = untag_ptr(o);
26032         o_conv.is_owned = ptr_is_owned(o);
26033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26034         o_conv = ChannelTransactionParameters_clone(&o_conv);
26035         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26036         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
26037         return tag_ptr(ret_conv, true);
26038 }
26039
26040 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
26041         void* e_ptr = untag_ptr(e);
26042         CHECK_ACCESS(e_ptr);
26043         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26044         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26045         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26046         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
26047         return tag_ptr(ret_conv, true);
26048 }
26049
26050 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
26051         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
26052         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
26053         return ret_conv;
26054 }
26055
26056 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
26057         if (!ptr_is_owned(_res)) return;
26058         void* _res_ptr = untag_ptr(_res);
26059         CHECK_ACCESS(_res_ptr);
26060         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
26061         FREE(untag_ptr(_res));
26062         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
26063 }
26064
26065 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
26066         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26067         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
26068         return tag_ptr(ret_conv, true);
26069 }
26070 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
26071         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
26072         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
26073         return ret_conv;
26074 }
26075
26076 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
26077         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
26078         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26079         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
26080         return tag_ptr(ret_conv, true);
26081 }
26082
26083 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26084         LDKHolderCommitmentTransaction o_conv;
26085         o_conv.inner = untag_ptr(o);
26086         o_conv.is_owned = ptr_is_owned(o);
26087         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26088         o_conv = HolderCommitmentTransaction_clone(&o_conv);
26089         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26090         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
26091         return tag_ptr(ret_conv, true);
26092 }
26093
26094 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26095         void* e_ptr = untag_ptr(e);
26096         CHECK_ACCESS(e_ptr);
26097         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26098         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26099         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26100         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
26101         return tag_ptr(ret_conv, true);
26102 }
26103
26104 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26105         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26106         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26107         return ret_conv;
26108 }
26109
26110 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26111         if (!ptr_is_owned(_res)) return;
26112         void* _res_ptr = untag_ptr(_res);
26113         CHECK_ACCESS(_res_ptr);
26114         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
26115         FREE(untag_ptr(_res));
26116         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
26117 }
26118
26119 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26120         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26121         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
26122         return tag_ptr(ret_conv, true);
26123 }
26124 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26125         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26126         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26127         return ret_conv;
26128 }
26129
26130 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26131         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26132         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26133         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
26134         return tag_ptr(ret_conv, true);
26135 }
26136
26137 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26138         LDKBuiltCommitmentTransaction o_conv;
26139         o_conv.inner = untag_ptr(o);
26140         o_conv.is_owned = ptr_is_owned(o);
26141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26142         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
26143         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26144         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
26145         return tag_ptr(ret_conv, true);
26146 }
26147
26148 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26149         void* e_ptr = untag_ptr(e);
26150         CHECK_ACCESS(e_ptr);
26151         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26152         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26153         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26154         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
26155         return tag_ptr(ret_conv, true);
26156 }
26157
26158 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26159         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26160         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26161         return ret_conv;
26162 }
26163
26164 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26165         if (!ptr_is_owned(_res)) return;
26166         void* _res_ptr = untag_ptr(_res);
26167         CHECK_ACCESS(_res_ptr);
26168         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
26169         FREE(untag_ptr(_res));
26170         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
26171 }
26172
26173 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26174         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26175         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
26176         return tag_ptr(ret_conv, true);
26177 }
26178 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26179         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26180         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26181         return ret_conv;
26182 }
26183
26184 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26185         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26186         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26187         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
26188         return tag_ptr(ret_conv, true);
26189 }
26190
26191 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
26192         LDKTrustedClosingTransaction o_conv;
26193         o_conv.inner = untag_ptr(o);
26194         o_conv.is_owned = ptr_is_owned(o);
26195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26196         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
26197         
26198         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26199         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
26200         return tag_ptr(ret_conv, true);
26201 }
26202
26203 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
26204         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26205         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
26206         return tag_ptr(ret_conv, true);
26207 }
26208
26209 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
26210         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
26211         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
26212         return ret_conv;
26213 }
26214
26215 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
26216         if (!ptr_is_owned(_res)) return;
26217         void* _res_ptr = untag_ptr(_res);
26218         CHECK_ACCESS(_res_ptr);
26219         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
26220         FREE(untag_ptr(_res));
26221         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
26222 }
26223
26224 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26225         LDKCommitmentTransaction o_conv;
26226         o_conv.inner = untag_ptr(o);
26227         o_conv.is_owned = ptr_is_owned(o);
26228         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26229         o_conv = CommitmentTransaction_clone(&o_conv);
26230         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26231         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
26232         return tag_ptr(ret_conv, true);
26233 }
26234
26235 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26236         void* e_ptr = untag_ptr(e);
26237         CHECK_ACCESS(e_ptr);
26238         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26239         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26240         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26241         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
26242         return tag_ptr(ret_conv, true);
26243 }
26244
26245 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26246         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26247         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26248         return ret_conv;
26249 }
26250
26251 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26252         if (!ptr_is_owned(_res)) return;
26253         void* _res_ptr = untag_ptr(_res);
26254         CHECK_ACCESS(_res_ptr);
26255         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
26256         FREE(untag_ptr(_res));
26257         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
26258 }
26259
26260 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26261         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26262         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
26263         return tag_ptr(ret_conv, true);
26264 }
26265 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26266         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26267         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26268         return ret_conv;
26269 }
26270
26271 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26272         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26273         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26274         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
26275         return tag_ptr(ret_conv, true);
26276 }
26277
26278 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
26279         LDKTrustedCommitmentTransaction o_conv;
26280         o_conv.inner = untag_ptr(o);
26281         o_conv.is_owned = ptr_is_owned(o);
26282         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26283         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
26284         
26285         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26286         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
26287         return tag_ptr(ret_conv, true);
26288 }
26289
26290 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
26291         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26292         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
26293         return tag_ptr(ret_conv, true);
26294 }
26295
26296 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
26297         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
26298         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
26299         return ret_conv;
26300 }
26301
26302 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
26303         if (!ptr_is_owned(_res)) return;
26304         void* _res_ptr = untag_ptr(_res);
26305         CHECK_ACCESS(_res_ptr);
26306         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
26307         FREE(untag_ptr(_res));
26308         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
26309 }
26310
26311 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
26312         LDKCVec_ECDSASignatureZ o_constr;
26313         o_constr.datalen = o->arr_len;
26314         if (o_constr.datalen > 0)
26315                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
26316         else
26317                 o_constr.data = NULL;
26318         int8_tArray* o_vals = (void*) o->elems;
26319         for (size_t m = 0; m < o_constr.datalen; m++) {
26320                 int8_tArray o_conv_12 = o_vals[m];
26321                 LDKECDSASignature o_conv_12_ref;
26322                 CHECK(o_conv_12->arr_len == 64);
26323                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
26324                 o_constr.data[m] = o_conv_12_ref;
26325         }
26326         FREE(o);
26327         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26328         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
26329         return tag_ptr(ret_conv, true);
26330 }
26331
26332 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
26333         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26334         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
26335         return tag_ptr(ret_conv, true);
26336 }
26337
26338 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
26339         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
26340         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
26341         return ret_conv;
26342 }
26343
26344 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
26345         if (!ptr_is_owned(_res)) return;
26346         void* _res_ptr = untag_ptr(_res);
26347         CHECK_ACCESS(_res_ptr);
26348         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
26349         FREE(untag_ptr(_res));
26350         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
26351 }
26352
26353 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
26354         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26355         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
26356         return tag_ptr(ret_conv, true);
26357 }
26358 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
26359         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
26360         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
26361         return ret_conv;
26362 }
26363
26364 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
26365         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
26366         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26367         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
26368         return tag_ptr(ret_conv, true);
26369 }
26370
26371 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
26372         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26373         *ret_copy = COption_usizeZ_some(o);
26374         uint64_t ret_ref = tag_ptr(ret_copy, true);
26375         return ret_ref;
26376 }
26377
26378 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
26379         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26380         *ret_copy = COption_usizeZ_none();
26381         uint64_t ret_ref = tag_ptr(ret_copy, true);
26382         return ret_ref;
26383 }
26384
26385 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
26386         if (!ptr_is_owned(_res)) return;
26387         void* _res_ptr = untag_ptr(_res);
26388         CHECK_ACCESS(_res_ptr);
26389         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
26390         FREE(untag_ptr(_res));
26391         COption_usizeZ_free(_res_conv);
26392 }
26393
26394 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
26395         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26396         *ret_copy = COption_usizeZ_clone(arg);
26397         uint64_t ret_ref = tag_ptr(ret_copy, true);
26398         return ret_ref;
26399 }
26400 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
26401         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
26402         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
26403         return ret_conv;
26404 }
26405
26406 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
26407         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
26408         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26409         *ret_copy = COption_usizeZ_clone(orig_conv);
26410         uint64_t ret_ref = tag_ptr(ret_copy, true);
26411         return ret_ref;
26412 }
26413
26414 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
26415         LDKShutdownScript o_conv;
26416         o_conv.inner = untag_ptr(o);
26417         o_conv.is_owned = ptr_is_owned(o);
26418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26419         o_conv = ShutdownScript_clone(&o_conv);
26420         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26421         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
26422         return tag_ptr(ret_conv, true);
26423 }
26424
26425 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
26426         void* e_ptr = untag_ptr(e);
26427         CHECK_ACCESS(e_ptr);
26428         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26429         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26430         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26431         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
26432         return tag_ptr(ret_conv, true);
26433 }
26434
26435 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
26436         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
26437         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
26438         return ret_conv;
26439 }
26440
26441 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
26442         if (!ptr_is_owned(_res)) return;
26443         void* _res_ptr = untag_ptr(_res);
26444         CHECK_ACCESS(_res_ptr);
26445         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
26446         FREE(untag_ptr(_res));
26447         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
26448 }
26449
26450 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
26451         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26452         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
26453         return tag_ptr(ret_conv, true);
26454 }
26455 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
26456         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
26457         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
26458         return ret_conv;
26459 }
26460
26461 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
26462         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
26463         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26464         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
26465         return tag_ptr(ret_conv, true);
26466 }
26467
26468 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
26469         LDKShutdownScript o_conv;
26470         o_conv.inner = untag_ptr(o);
26471         o_conv.is_owned = ptr_is_owned(o);
26472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26473         o_conv = ShutdownScript_clone(&o_conv);
26474         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26475         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
26476         return tag_ptr(ret_conv, true);
26477 }
26478
26479 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
26480         LDKInvalidShutdownScript e_conv;
26481         e_conv.inner = untag_ptr(e);
26482         e_conv.is_owned = ptr_is_owned(e);
26483         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26484         e_conv = InvalidShutdownScript_clone(&e_conv);
26485         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26486         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
26487         return tag_ptr(ret_conv, true);
26488 }
26489
26490 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
26491         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
26492         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
26493         return ret_conv;
26494 }
26495
26496 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
26497         if (!ptr_is_owned(_res)) return;
26498         void* _res_ptr = untag_ptr(_res);
26499         CHECK_ACCESS(_res_ptr);
26500         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
26501         FREE(untag_ptr(_res));
26502         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
26503 }
26504
26505 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
26506         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26507         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
26508         return tag_ptr(ret_conv, true);
26509 }
26510 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
26511         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
26512         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
26513         return ret_conv;
26514 }
26515
26516 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
26517         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
26518         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26519         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
26520         return tag_ptr(ret_conv, true);
26521 }
26522
26523 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
26524         void* o_ptr = untag_ptr(o);
26525         CHECK_ACCESS(o_ptr);
26526         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
26527         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
26528         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26529         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
26530         return tag_ptr(ret_conv, true);
26531 }
26532
26533 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
26534         void* e_ptr = untag_ptr(e);
26535         CHECK_ACCESS(e_ptr);
26536         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26537         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26538         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26539         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
26540         return tag_ptr(ret_conv, true);
26541 }
26542
26543 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
26544         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
26545         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
26546         return ret_conv;
26547 }
26548
26549 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
26550         if (!ptr_is_owned(_res)) return;
26551         void* _res_ptr = untag_ptr(_res);
26552         CHECK_ACCESS(_res_ptr);
26553         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
26554         FREE(untag_ptr(_res));
26555         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
26556 }
26557
26558 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
26559         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26560         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
26561         return tag_ptr(ret_conv, true);
26562 }
26563 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
26564         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
26565         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
26566         return ret_conv;
26567 }
26568
26569 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
26570         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
26571         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26572         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
26573         return tag_ptr(ret_conv, true);
26574 }
26575
26576 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
26577         LDKClaimedHTLC o_conv;
26578         o_conv.inner = untag_ptr(o);
26579         o_conv.is_owned = ptr_is_owned(o);
26580         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26581         o_conv = ClaimedHTLC_clone(&o_conv);
26582         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
26583         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
26584         return tag_ptr(ret_conv, true);
26585 }
26586
26587 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
26588         void* e_ptr = untag_ptr(e);
26589         CHECK_ACCESS(e_ptr);
26590         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26591         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26592         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
26593         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
26594         return tag_ptr(ret_conv, true);
26595 }
26596
26597 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
26598         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
26599         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
26600         return ret_conv;
26601 }
26602
26603 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
26604         if (!ptr_is_owned(_res)) return;
26605         void* _res_ptr = untag_ptr(_res);
26606         CHECK_ACCESS(_res_ptr);
26607         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
26608         FREE(untag_ptr(_res));
26609         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
26610 }
26611
26612 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
26613         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
26614         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
26615         return tag_ptr(ret_conv, true);
26616 }
26617 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
26618         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
26619         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
26620         return ret_conv;
26621 }
26622
26623 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
26624         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
26625         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
26626         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
26627         return tag_ptr(ret_conv, true);
26628 }
26629
26630 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
26631         void* o_ptr = untag_ptr(o);
26632         CHECK_ACCESS(o_ptr);
26633         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
26634         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
26635         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
26636         *ret_copy = COption_PathFailureZ_some(o_conv);
26637         uint64_t ret_ref = tag_ptr(ret_copy, true);
26638         return ret_ref;
26639 }
26640
26641 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
26642         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
26643         *ret_copy = COption_PathFailureZ_none();
26644         uint64_t ret_ref = tag_ptr(ret_copy, true);
26645         return ret_ref;
26646 }
26647
26648 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
26649         if (!ptr_is_owned(_res)) return;
26650         void* _res_ptr = untag_ptr(_res);
26651         CHECK_ACCESS(_res_ptr);
26652         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
26653         FREE(untag_ptr(_res));
26654         COption_PathFailureZ_free(_res_conv);
26655 }
26656
26657 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
26658         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
26659         *ret_copy = COption_PathFailureZ_clone(arg);
26660         uint64_t ret_ref = tag_ptr(ret_copy, true);
26661         return ret_ref;
26662 }
26663 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
26664         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
26665         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
26666         return ret_conv;
26667 }
26668
26669 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
26670         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
26671         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
26672         *ret_copy = COption_PathFailureZ_clone(orig_conv);
26673         uint64_t ret_ref = tag_ptr(ret_copy, true);
26674         return ret_ref;
26675 }
26676
26677 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
26678         void* o_ptr = untag_ptr(o);
26679         CHECK_ACCESS(o_ptr);
26680         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
26681         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
26682         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26683         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
26684         return tag_ptr(ret_conv, true);
26685 }
26686
26687 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
26688         void* e_ptr = untag_ptr(e);
26689         CHECK_ACCESS(e_ptr);
26690         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26691         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26692         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26693         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
26694         return tag_ptr(ret_conv, true);
26695 }
26696
26697 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
26698         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
26699         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
26700         return ret_conv;
26701 }
26702
26703 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
26704         if (!ptr_is_owned(_res)) return;
26705         void* _res_ptr = untag_ptr(_res);
26706         CHECK_ACCESS(_res_ptr);
26707         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
26708         FREE(untag_ptr(_res));
26709         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
26710 }
26711
26712 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
26713         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26714         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
26715         return tag_ptr(ret_conv, true);
26716 }
26717 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
26718         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
26719         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
26720         return ret_conv;
26721 }
26722
26723 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
26724         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
26725         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26726         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
26727         return tag_ptr(ret_conv, true);
26728 }
26729
26730 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
26731         void* o_ptr = untag_ptr(o);
26732         CHECK_ACCESS(o_ptr);
26733         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
26734         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
26735         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
26736         *ret_copy = COption_ClosureReasonZ_some(o_conv);
26737         uint64_t ret_ref = tag_ptr(ret_copy, true);
26738         return ret_ref;
26739 }
26740
26741 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
26742         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
26743         *ret_copy = COption_ClosureReasonZ_none();
26744         uint64_t ret_ref = tag_ptr(ret_copy, true);
26745         return ret_ref;
26746 }
26747
26748 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
26749         if (!ptr_is_owned(_res)) return;
26750         void* _res_ptr = untag_ptr(_res);
26751         CHECK_ACCESS(_res_ptr);
26752         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
26753         FREE(untag_ptr(_res));
26754         COption_ClosureReasonZ_free(_res_conv);
26755 }
26756
26757 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
26758         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
26759         *ret_copy = COption_ClosureReasonZ_clone(arg);
26760         uint64_t ret_ref = tag_ptr(ret_copy, true);
26761         return ret_ref;
26762 }
26763 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
26764         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
26765         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
26766         return ret_conv;
26767 }
26768
26769 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
26770         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
26771         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
26772         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
26773         uint64_t ret_ref = tag_ptr(ret_copy, true);
26774         return ret_ref;
26775 }
26776
26777 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
26778         void* o_ptr = untag_ptr(o);
26779         CHECK_ACCESS(o_ptr);
26780         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
26781         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
26782         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26783         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
26784         return tag_ptr(ret_conv, true);
26785 }
26786
26787 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
26788         void* e_ptr = untag_ptr(e);
26789         CHECK_ACCESS(e_ptr);
26790         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26791         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26792         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26793         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
26794         return tag_ptr(ret_conv, true);
26795 }
26796
26797 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
26798         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
26799         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
26800         return ret_conv;
26801 }
26802
26803 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
26804         if (!ptr_is_owned(_res)) return;
26805         void* _res_ptr = untag_ptr(_res);
26806         CHECK_ACCESS(_res_ptr);
26807         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
26808         FREE(untag_ptr(_res));
26809         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
26810 }
26811
26812 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
26813         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26814         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
26815         return tag_ptr(ret_conv, true);
26816 }
26817 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
26818         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
26819         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
26820         return ret_conv;
26821 }
26822
26823 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
26824         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
26825         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26826         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
26827         return tag_ptr(ret_conv, true);
26828 }
26829
26830 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
26831         void* o_ptr = untag_ptr(o);
26832         CHECK_ACCESS(o_ptr);
26833         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
26834         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
26835         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
26836         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
26837         uint64_t ret_ref = tag_ptr(ret_copy, true);
26838         return ret_ref;
26839 }
26840
26841 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
26842         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
26843         *ret_copy = COption_HTLCDestinationZ_none();
26844         uint64_t ret_ref = tag_ptr(ret_copy, true);
26845         return ret_ref;
26846 }
26847
26848 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
26849         if (!ptr_is_owned(_res)) return;
26850         void* _res_ptr = untag_ptr(_res);
26851         CHECK_ACCESS(_res_ptr);
26852         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
26853         FREE(untag_ptr(_res));
26854         COption_HTLCDestinationZ_free(_res_conv);
26855 }
26856
26857 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
26858         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
26859         *ret_copy = COption_HTLCDestinationZ_clone(arg);
26860         uint64_t ret_ref = tag_ptr(ret_copy, true);
26861         return ret_ref;
26862 }
26863 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
26864         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
26865         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
26866         return ret_conv;
26867 }
26868
26869 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
26870         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
26871         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
26872         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
26873         uint64_t ret_ref = tag_ptr(ret_copy, true);
26874         return ret_ref;
26875 }
26876
26877 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
26878         void* o_ptr = untag_ptr(o);
26879         CHECK_ACCESS(o_ptr);
26880         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
26881         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
26882         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26883         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
26884         return tag_ptr(ret_conv, true);
26885 }
26886
26887 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
26888         void* e_ptr = untag_ptr(e);
26889         CHECK_ACCESS(e_ptr);
26890         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26891         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26892         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26893         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
26894         return tag_ptr(ret_conv, true);
26895 }
26896
26897 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
26898         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
26899         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
26900         return ret_conv;
26901 }
26902
26903 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
26904         if (!ptr_is_owned(_res)) return;
26905         void* _res_ptr = untag_ptr(_res);
26906         CHECK_ACCESS(_res_ptr);
26907         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
26908         FREE(untag_ptr(_res));
26909         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
26910 }
26911
26912 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
26913         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26914         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
26915         return tag_ptr(ret_conv, true);
26916 }
26917 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
26918         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
26919         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
26920         return ret_conv;
26921 }
26922
26923 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
26924         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
26925         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26926         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
26927         return tag_ptr(ret_conv, true);
26928 }
26929
26930 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
26931         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
26932         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
26933         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
26934         return tag_ptr(ret_conv, true);
26935 }
26936
26937 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
26938         void* e_ptr = untag_ptr(e);
26939         CHECK_ACCESS(e_ptr);
26940         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26941         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26942         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
26943         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
26944         return tag_ptr(ret_conv, true);
26945 }
26946
26947 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
26948         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
26949         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
26950         return ret_conv;
26951 }
26952
26953 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
26954         if (!ptr_is_owned(_res)) return;
26955         void* _res_ptr = untag_ptr(_res);
26956         CHECK_ACCESS(_res_ptr);
26957         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
26958         FREE(untag_ptr(_res));
26959         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
26960 }
26961
26962 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
26963         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
26964         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
26965         return tag_ptr(ret_conv, true);
26966 }
26967 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
26968         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
26969         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
26970         return ret_conv;
26971 }
26972
26973 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
26974         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
26975         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
26976         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
26977         return tag_ptr(ret_conv, true);
26978 }
26979
26980 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
26981         LDKU128 o_ref;
26982         CHECK(o->arr_len == 16);
26983         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
26984         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
26985         *ret_copy = COption_U128Z_some(o_ref);
26986         uint64_t ret_ref = tag_ptr(ret_copy, true);
26987         return ret_ref;
26988 }
26989
26990 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
26991         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
26992         *ret_copy = COption_U128Z_none();
26993         uint64_t ret_ref = tag_ptr(ret_copy, true);
26994         return ret_ref;
26995 }
26996
26997 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
26998         if (!ptr_is_owned(_res)) return;
26999         void* _res_ptr = untag_ptr(_res);
27000         CHECK_ACCESS(_res_ptr);
27001         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
27002         FREE(untag_ptr(_res));
27003         COption_U128Z_free(_res_conv);
27004 }
27005
27006 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
27007         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27008         *ret_copy = COption_U128Z_clone(arg);
27009         uint64_t ret_ref = tag_ptr(ret_copy, true);
27010         return ret_ref;
27011 }
27012 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
27013         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
27014         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
27015         return ret_conv;
27016 }
27017
27018 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
27019         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
27020         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27021         *ret_copy = COption_U128Z_clone(orig_conv);
27022         uint64_t ret_ref = tag_ptr(ret_copy, true);
27023         return ret_ref;
27024 }
27025
27026 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
27027         LDKCVec_ClaimedHTLCZ _res_constr;
27028         _res_constr.datalen = _res->arr_len;
27029         if (_res_constr.datalen > 0)
27030                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
27031         else
27032                 _res_constr.data = NULL;
27033         uint64_t* _res_vals = _res->elems;
27034         for (size_t n = 0; n < _res_constr.datalen; n++) {
27035                 uint64_t _res_conv_13 = _res_vals[n];
27036                 LDKClaimedHTLC _res_conv_13_conv;
27037                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
27038                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
27039                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
27040                 _res_constr.data[n] = _res_conv_13_conv;
27041         }
27042         FREE(_res);
27043         CVec_ClaimedHTLCZ_free(_res_constr);
27044 }
27045
27046 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
27047         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
27048         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27049         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
27050         uint64_t ret_ref = tag_ptr(ret_copy, true);
27051         return ret_ref;
27052 }
27053
27054 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
27055         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27056         *ret_copy = COption_PaymentFailureReasonZ_none();
27057         uint64_t ret_ref = tag_ptr(ret_copy, true);
27058         return ret_ref;
27059 }
27060
27061 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
27062         if (!ptr_is_owned(_res)) return;
27063         void* _res_ptr = untag_ptr(_res);
27064         CHECK_ACCESS(_res_ptr);
27065         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
27066         FREE(untag_ptr(_res));
27067         COption_PaymentFailureReasonZ_free(_res_conv);
27068 }
27069
27070 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
27071         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27072         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
27073         uint64_t ret_ref = tag_ptr(ret_copy, true);
27074         return ret_ref;
27075 }
27076 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
27077         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
27078         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
27079         return ret_conv;
27080 }
27081
27082 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
27083         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
27084         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27085         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
27086         uint64_t ret_ref = tag_ptr(ret_copy, true);
27087         return ret_ref;
27088 }
27089
27090 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
27091         void* o_ptr = untag_ptr(o);
27092         CHECK_ACCESS(o_ptr);
27093         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
27094         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
27095         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27096         *ret_copy = COption_EventZ_some(o_conv);
27097         uint64_t ret_ref = tag_ptr(ret_copy, true);
27098         return ret_ref;
27099 }
27100
27101 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
27102         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27103         *ret_copy = COption_EventZ_none();
27104         uint64_t ret_ref = tag_ptr(ret_copy, true);
27105         return ret_ref;
27106 }
27107
27108 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
27109         if (!ptr_is_owned(_res)) return;
27110         void* _res_ptr = untag_ptr(_res);
27111         CHECK_ACCESS(_res_ptr);
27112         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
27113         FREE(untag_ptr(_res));
27114         COption_EventZ_free(_res_conv);
27115 }
27116
27117 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
27118         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27119         *ret_copy = COption_EventZ_clone(arg);
27120         uint64_t ret_ref = tag_ptr(ret_copy, true);
27121         return ret_ref;
27122 }
27123 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
27124         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
27125         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
27126         return ret_conv;
27127 }
27128
27129 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
27130         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
27131         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27132         *ret_copy = COption_EventZ_clone(orig_conv);
27133         uint64_t ret_ref = tag_ptr(ret_copy, true);
27134         return ret_ref;
27135 }
27136
27137 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
27138         void* o_ptr = untag_ptr(o);
27139         CHECK_ACCESS(o_ptr);
27140         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
27141         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
27142         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27143         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
27144         return tag_ptr(ret_conv, true);
27145 }
27146
27147 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
27148         void* e_ptr = untag_ptr(e);
27149         CHECK_ACCESS(e_ptr);
27150         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27151         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27152         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27153         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
27154         return tag_ptr(ret_conv, true);
27155 }
27156
27157 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
27158         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
27159         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
27160         return ret_conv;
27161 }
27162
27163 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
27164         if (!ptr_is_owned(_res)) return;
27165         void* _res_ptr = untag_ptr(_res);
27166         CHECK_ACCESS(_res_ptr);
27167         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
27168         FREE(untag_ptr(_res));
27169         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
27170 }
27171
27172 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
27173         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27174         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
27175         return tag_ptr(ret_conv, true);
27176 }
27177 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
27178         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
27179         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
27180         return ret_conv;
27181 }
27182
27183 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
27184         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
27185         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27186         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
27187         return tag_ptr(ret_conv, true);
27188 }
27189
27190 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
27191         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
27192         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27193         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
27194         return tag_ptr(ret_conv, true);
27195 }
27196
27197 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
27198         void* e_ptr = untag_ptr(e);
27199         CHECK_ACCESS(e_ptr);
27200         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
27201         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
27202         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27203         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
27204         return tag_ptr(ret_conv, true);
27205 }
27206
27207 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
27208         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
27209         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
27210         return ret_conv;
27211 }
27212
27213 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
27214         if (!ptr_is_owned(_res)) return;
27215         void* _res_ptr = untag_ptr(_res);
27216         CHECK_ACCESS(_res_ptr);
27217         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
27218         FREE(untag_ptr(_res));
27219         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
27220 }
27221
27222 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
27223         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27224         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
27225         return tag_ptr(ret_conv, true);
27226 }
27227 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
27228         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
27229         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
27230         return ret_conv;
27231 }
27232
27233 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
27234         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
27235         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27236         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
27237         return tag_ptr(ret_conv, true);
27238 }
27239
27240 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
27241         LDKBolt11Invoice o_conv;
27242         o_conv.inner = untag_ptr(o);
27243         o_conv.is_owned = ptr_is_owned(o);
27244         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27245         o_conv = Bolt11Invoice_clone(&o_conv);
27246         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27247         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
27248         return tag_ptr(ret_conv, true);
27249 }
27250
27251 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
27252         void* e_ptr = untag_ptr(e);
27253         CHECK_ACCESS(e_ptr);
27254         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
27255         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
27256         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27257         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
27258         return tag_ptr(ret_conv, true);
27259 }
27260
27261 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
27262         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
27263         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
27264         return ret_conv;
27265 }
27266
27267 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
27268         if (!ptr_is_owned(_res)) return;
27269         void* _res_ptr = untag_ptr(_res);
27270         CHECK_ACCESS(_res_ptr);
27271         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
27272         FREE(untag_ptr(_res));
27273         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
27274 }
27275
27276 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
27277         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27278         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
27279         return tag_ptr(ret_conv, true);
27280 }
27281 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
27282         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
27283         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
27284         return ret_conv;
27285 }
27286
27287 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
27288         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
27289         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27290         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
27291         return tag_ptr(ret_conv, true);
27292 }
27293
27294 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
27295         LDKSignedRawBolt11Invoice o_conv;
27296         o_conv.inner = untag_ptr(o);
27297         o_conv.is_owned = ptr_is_owned(o);
27298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27299         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
27300         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27301         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
27302         return tag_ptr(ret_conv, true);
27303 }
27304
27305 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
27306         void* e_ptr = untag_ptr(e);
27307         CHECK_ACCESS(e_ptr);
27308         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
27309         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
27310         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27311         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
27312         return tag_ptr(ret_conv, true);
27313 }
27314
27315 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
27316         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
27317         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
27318         return ret_conv;
27319 }
27320
27321 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
27322         if (!ptr_is_owned(_res)) return;
27323         void* _res_ptr = untag_ptr(_res);
27324         CHECK_ACCESS(_res_ptr);
27325         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
27326         FREE(untag_ptr(_res));
27327         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
27328 }
27329
27330 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
27331         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27332         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
27333         return tag_ptr(ret_conv, true);
27334 }
27335 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
27336         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
27337         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
27338         return ret_conv;
27339 }
27340
27341 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
27342         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
27343         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27344         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
27345         return tag_ptr(ret_conv, true);
27346 }
27347
27348 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
27349         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27350         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
27351         return tag_ptr(ret_conv, true);
27352 }
27353 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
27354         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
27355         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
27356         return ret_conv;
27357 }
27358
27359 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
27360         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
27361         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27362         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
27363         return tag_ptr(ret_conv, true);
27364 }
27365
27366 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
27367         LDKRawBolt11Invoice a_conv;
27368         a_conv.inner = untag_ptr(a);
27369         a_conv.is_owned = ptr_is_owned(a);
27370         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27371         a_conv = RawBolt11Invoice_clone(&a_conv);
27372         LDKThirtyTwoBytes b_ref;
27373         CHECK(b->arr_len == 32);
27374         memcpy(b_ref.data, b->elems, 32); FREE(b);
27375         LDKBolt11InvoiceSignature c_conv;
27376         c_conv.inner = untag_ptr(c);
27377         c_conv.is_owned = ptr_is_owned(c);
27378         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27379         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
27380         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27381         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
27382         return tag_ptr(ret_conv, true);
27383 }
27384
27385 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
27386         if (!ptr_is_owned(_res)) return;
27387         void* _res_ptr = untag_ptr(_res);
27388         CHECK_ACCESS(_res_ptr);
27389         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
27390         FREE(untag_ptr(_res));
27391         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
27392 }
27393
27394 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
27395         LDKPayeePubKey o_conv;
27396         o_conv.inner = untag_ptr(o);
27397         o_conv.is_owned = ptr_is_owned(o);
27398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27399         o_conv = PayeePubKey_clone(&o_conv);
27400         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27401         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
27402         return tag_ptr(ret_conv, true);
27403 }
27404
27405 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
27406         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
27407         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27408         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
27409         return tag_ptr(ret_conv, true);
27410 }
27411
27412 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
27413         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
27414         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
27415         return ret_conv;
27416 }
27417
27418 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
27419         if (!ptr_is_owned(_res)) return;
27420         void* _res_ptr = untag_ptr(_res);
27421         CHECK_ACCESS(_res_ptr);
27422         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
27423         FREE(untag_ptr(_res));
27424         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
27425 }
27426
27427 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
27428         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27429         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
27430         return tag_ptr(ret_conv, true);
27431 }
27432 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
27433         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
27434         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
27435         return ret_conv;
27436 }
27437
27438 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
27439         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
27440         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27441         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
27442         return tag_ptr(ret_conv, true);
27443 }
27444
27445 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
27446         LDKCVec_PrivateRouteZ _res_constr;
27447         _res_constr.datalen = _res->arr_len;
27448         if (_res_constr.datalen > 0)
27449                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
27450         else
27451                 _res_constr.data = NULL;
27452         uint64_t* _res_vals = _res->elems;
27453         for (size_t o = 0; o < _res_constr.datalen; o++) {
27454                 uint64_t _res_conv_14 = _res_vals[o];
27455                 LDKPrivateRoute _res_conv_14_conv;
27456                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
27457                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
27458                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
27459                 _res_constr.data[o] = _res_conv_14_conv;
27460         }
27461         FREE(_res);
27462         CVec_PrivateRouteZ_free(_res_constr);
27463 }
27464
27465 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
27466         LDKPositiveTimestamp o_conv;
27467         o_conv.inner = untag_ptr(o);
27468         o_conv.is_owned = ptr_is_owned(o);
27469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27470         o_conv = PositiveTimestamp_clone(&o_conv);
27471         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27472         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
27473         return tag_ptr(ret_conv, true);
27474 }
27475
27476 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
27477         LDKCreationError e_conv = LDKCreationError_from_js(e);
27478         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27479         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
27480         return tag_ptr(ret_conv, true);
27481 }
27482
27483 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
27484         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
27485         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
27486         return ret_conv;
27487 }
27488
27489 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
27490         if (!ptr_is_owned(_res)) return;
27491         void* _res_ptr = untag_ptr(_res);
27492         CHECK_ACCESS(_res_ptr);
27493         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
27494         FREE(untag_ptr(_res));
27495         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
27496 }
27497
27498 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
27499         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27500         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
27501         return tag_ptr(ret_conv, true);
27502 }
27503 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
27504         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
27505         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
27506         return ret_conv;
27507 }
27508
27509 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
27510         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
27511         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27512         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
27513         return tag_ptr(ret_conv, true);
27514 }
27515
27516 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
27517         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27518         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
27519         return tag_ptr(ret_conv, true);
27520 }
27521
27522 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
27523         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27524         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27525         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
27526         return tag_ptr(ret_conv, true);
27527 }
27528
27529 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
27530         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
27531         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
27532         return ret_conv;
27533 }
27534
27535 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
27536         if (!ptr_is_owned(_res)) return;
27537         void* _res_ptr = untag_ptr(_res);
27538         CHECK_ACCESS(_res_ptr);
27539         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
27540         FREE(untag_ptr(_res));
27541         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
27542 }
27543
27544 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
27545         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27546         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
27547         return tag_ptr(ret_conv, true);
27548 }
27549 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
27550         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
27551         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
27552         return ret_conv;
27553 }
27554
27555 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
27556         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
27557         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27558         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
27559         return tag_ptr(ret_conv, true);
27560 }
27561
27562 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
27563         LDKBolt11Invoice o_conv;
27564         o_conv.inner = untag_ptr(o);
27565         o_conv.is_owned = ptr_is_owned(o);
27566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27567         o_conv = Bolt11Invoice_clone(&o_conv);
27568         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27569         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
27570         return tag_ptr(ret_conv, true);
27571 }
27572
27573 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
27574         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27575         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27576         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
27577         return tag_ptr(ret_conv, true);
27578 }
27579
27580 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
27581         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
27582         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
27583         return ret_conv;
27584 }
27585
27586 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
27587         if (!ptr_is_owned(_res)) return;
27588         void* _res_ptr = untag_ptr(_res);
27589         CHECK_ACCESS(_res_ptr);
27590         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
27591         FREE(untag_ptr(_res));
27592         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
27593 }
27594
27595 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
27596         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27597         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
27598         return tag_ptr(ret_conv, true);
27599 }
27600 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
27601         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
27602         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
27603         return ret_conv;
27604 }
27605
27606 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
27607         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
27608         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27609         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
27610         return tag_ptr(ret_conv, true);
27611 }
27612
27613 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
27614         LDKDescription o_conv;
27615         o_conv.inner = untag_ptr(o);
27616         o_conv.is_owned = ptr_is_owned(o);
27617         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27618         o_conv = Description_clone(&o_conv);
27619         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27620         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
27621         return tag_ptr(ret_conv, true);
27622 }
27623
27624 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
27625         LDKCreationError e_conv = LDKCreationError_from_js(e);
27626         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27627         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
27628         return tag_ptr(ret_conv, true);
27629 }
27630
27631 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
27632         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
27633         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
27634         return ret_conv;
27635 }
27636
27637 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
27638         if (!ptr_is_owned(_res)) return;
27639         void* _res_ptr = untag_ptr(_res);
27640         CHECK_ACCESS(_res_ptr);
27641         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
27642         FREE(untag_ptr(_res));
27643         CResult_DescriptionCreationErrorZ_free(_res_conv);
27644 }
27645
27646 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
27647         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27648         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
27649         return tag_ptr(ret_conv, true);
27650 }
27651 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
27652         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
27653         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
27654         return ret_conv;
27655 }
27656
27657 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
27658         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
27659         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27660         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
27661         return tag_ptr(ret_conv, true);
27662 }
27663
27664 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
27665         LDKPrivateRoute o_conv;
27666         o_conv.inner = untag_ptr(o);
27667         o_conv.is_owned = ptr_is_owned(o);
27668         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27669         o_conv = PrivateRoute_clone(&o_conv);
27670         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27671         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
27672         return tag_ptr(ret_conv, true);
27673 }
27674
27675 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
27676         LDKCreationError e_conv = LDKCreationError_from_js(e);
27677         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27678         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
27679         return tag_ptr(ret_conv, true);
27680 }
27681
27682 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
27683         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
27684         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
27685         return ret_conv;
27686 }
27687
27688 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
27689         if (!ptr_is_owned(_res)) return;
27690         void* _res_ptr = untag_ptr(_res);
27691         CHECK_ACCESS(_res_ptr);
27692         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
27693         FREE(untag_ptr(_res));
27694         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
27695 }
27696
27697 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
27698         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27699         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
27700         return tag_ptr(ret_conv, true);
27701 }
27702 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
27703         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
27704         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
27705         return ret_conv;
27706 }
27707
27708 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
27709         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
27710         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27711         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
27712         return tag_ptr(ret_conv, true);
27713 }
27714
27715 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
27716         LDKOutPoint o_conv;
27717         o_conv.inner = untag_ptr(o);
27718         o_conv.is_owned = ptr_is_owned(o);
27719         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27720         o_conv = OutPoint_clone(&o_conv);
27721         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27722         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
27723         return tag_ptr(ret_conv, true);
27724 }
27725
27726 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
27727         void* e_ptr = untag_ptr(e);
27728         CHECK_ACCESS(e_ptr);
27729         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27730         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27731         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27732         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
27733         return tag_ptr(ret_conv, true);
27734 }
27735
27736 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
27737         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
27738         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
27739         return ret_conv;
27740 }
27741
27742 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
27743         if (!ptr_is_owned(_res)) return;
27744         void* _res_ptr = untag_ptr(_res);
27745         CHECK_ACCESS(_res_ptr);
27746         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
27747         FREE(untag_ptr(_res));
27748         CResult_OutPointDecodeErrorZ_free(_res_conv);
27749 }
27750
27751 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
27752         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27753         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
27754         return tag_ptr(ret_conv, true);
27755 }
27756 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
27757         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
27758         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
27759         return ret_conv;
27760 }
27761
27762 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
27763         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
27764         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27765         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
27766         return tag_ptr(ret_conv, true);
27767 }
27768
27769 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
27770         LDKBigSize o_conv;
27771         o_conv.inner = untag_ptr(o);
27772         o_conv.is_owned = ptr_is_owned(o);
27773         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27774         o_conv = BigSize_clone(&o_conv);
27775         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27776         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
27777         return tag_ptr(ret_conv, true);
27778 }
27779
27780 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
27781         void* e_ptr = untag_ptr(e);
27782         CHECK_ACCESS(e_ptr);
27783         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27784         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27785         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27786         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
27787         return tag_ptr(ret_conv, true);
27788 }
27789
27790 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
27791         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
27792         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
27793         return ret_conv;
27794 }
27795
27796 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
27797         if (!ptr_is_owned(_res)) return;
27798         void* _res_ptr = untag_ptr(_res);
27799         CHECK_ACCESS(_res_ptr);
27800         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
27801         FREE(untag_ptr(_res));
27802         CResult_BigSizeDecodeErrorZ_free(_res_conv);
27803 }
27804
27805 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
27806         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27807         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
27808         return tag_ptr(ret_conv, true);
27809 }
27810 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
27811         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
27812         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
27813         return ret_conv;
27814 }
27815
27816 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
27817         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
27818         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27819         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
27820         return tag_ptr(ret_conv, true);
27821 }
27822
27823 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
27824         LDKHostname o_conv;
27825         o_conv.inner = untag_ptr(o);
27826         o_conv.is_owned = ptr_is_owned(o);
27827         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27828         o_conv = Hostname_clone(&o_conv);
27829         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27830         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
27831         return tag_ptr(ret_conv, true);
27832 }
27833
27834 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
27835         void* e_ptr = untag_ptr(e);
27836         CHECK_ACCESS(e_ptr);
27837         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27838         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27839         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27840         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
27841         return tag_ptr(ret_conv, true);
27842 }
27843
27844 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
27845         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
27846         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
27847         return ret_conv;
27848 }
27849
27850 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
27851         if (!ptr_is_owned(_res)) return;
27852         void* _res_ptr = untag_ptr(_res);
27853         CHECK_ACCESS(_res_ptr);
27854         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
27855         FREE(untag_ptr(_res));
27856         CResult_HostnameDecodeErrorZ_free(_res_conv);
27857 }
27858
27859 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
27860         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27861         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
27862         return tag_ptr(ret_conv, true);
27863 }
27864 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
27865         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
27866         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
27867         return ret_conv;
27868 }
27869
27870 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
27871         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
27872         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27873         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
27874         return tag_ptr(ret_conv, true);
27875 }
27876
27877 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
27878         LDKTransactionU16LenLimited o_conv;
27879         o_conv.inner = untag_ptr(o);
27880         o_conv.is_owned = ptr_is_owned(o);
27881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27882         o_conv = TransactionU16LenLimited_clone(&o_conv);
27883         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27884         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
27885         return tag_ptr(ret_conv, true);
27886 }
27887
27888 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
27889         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27890         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
27891         return tag_ptr(ret_conv, true);
27892 }
27893
27894 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
27895         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
27896         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
27897         return ret_conv;
27898 }
27899
27900 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
27901         if (!ptr_is_owned(_res)) return;
27902         void* _res_ptr = untag_ptr(_res);
27903         CHECK_ACCESS(_res_ptr);
27904         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
27905         FREE(untag_ptr(_res));
27906         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
27907 }
27908
27909 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
27910         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27911         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
27912         return tag_ptr(ret_conv, true);
27913 }
27914 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
27915         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
27916         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
27917         return ret_conv;
27918 }
27919
27920 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
27921         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
27922         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27923         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
27924         return tag_ptr(ret_conv, true);
27925 }
27926
27927 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
27928         LDKTransactionU16LenLimited o_conv;
27929         o_conv.inner = untag_ptr(o);
27930         o_conv.is_owned = ptr_is_owned(o);
27931         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27932         o_conv = TransactionU16LenLimited_clone(&o_conv);
27933         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27934         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
27935         return tag_ptr(ret_conv, true);
27936 }
27937
27938 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
27939         void* e_ptr = untag_ptr(e);
27940         CHECK_ACCESS(e_ptr);
27941         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27942         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27943         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27944         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
27945         return tag_ptr(ret_conv, true);
27946 }
27947
27948 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
27949         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
27950         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
27951         return ret_conv;
27952 }
27953
27954 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
27955         if (!ptr_is_owned(_res)) return;
27956         void* _res_ptr = untag_ptr(_res);
27957         CHECK_ACCESS(_res_ptr);
27958         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
27959         FREE(untag_ptr(_res));
27960         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
27961 }
27962
27963 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
27964         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27965         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
27966         return tag_ptr(ret_conv, true);
27967 }
27968 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
27969         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
27970         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
27971         return ret_conv;
27972 }
27973
27974 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
27975         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
27976         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27977         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
27978         return tag_ptr(ret_conv, true);
27979 }
27980
27981 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
27982         LDKUntrustedString o_conv;
27983         o_conv.inner = untag_ptr(o);
27984         o_conv.is_owned = ptr_is_owned(o);
27985         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27986         o_conv = UntrustedString_clone(&o_conv);
27987         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
27988         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
27989         return tag_ptr(ret_conv, true);
27990 }
27991
27992 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
27993         void* e_ptr = untag_ptr(e);
27994         CHECK_ACCESS(e_ptr);
27995         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27996         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27997         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
27998         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
27999         return tag_ptr(ret_conv, true);
28000 }
28001
28002 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
28003         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
28004         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
28005         return ret_conv;
28006 }
28007
28008 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
28009         if (!ptr_is_owned(_res)) return;
28010         void* _res_ptr = untag_ptr(_res);
28011         CHECK_ACCESS(_res_ptr);
28012         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
28013         FREE(untag_ptr(_res));
28014         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
28015 }
28016
28017 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
28018         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28019         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
28020         return tag_ptr(ret_conv, true);
28021 }
28022 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
28023         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
28024         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
28025         return ret_conv;
28026 }
28027
28028 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
28029         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
28030         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28031         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
28032         return tag_ptr(ret_conv, true);
28033 }
28034
28035 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_ok(uint64_t o) {
28036         LDKReceiveTlvs o_conv;
28037         o_conv.inner = untag_ptr(o);
28038         o_conv.is_owned = ptr_is_owned(o);
28039         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28040         o_conv = ReceiveTlvs_clone(&o_conv);
28041         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28042         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_ok(o_conv);
28043         return tag_ptr(ret_conv, true);
28044 }
28045
28046 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_err"))) TS_CResult_ReceiveTlvsDecodeErrorZ_err(uint64_t e) {
28047         void* e_ptr = untag_ptr(e);
28048         CHECK_ACCESS(e_ptr);
28049         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28050         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28051         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28052         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_err(e_conv);
28053         return tag_ptr(ret_conv, true);
28054 }
28055
28056 jboolean  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_is_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_is_ok(uint64_t o) {
28057         LDKCResult_ReceiveTlvsDecodeErrorZ* o_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(o);
28058         jboolean ret_conv = CResult_ReceiveTlvsDecodeErrorZ_is_ok(o_conv);
28059         return ret_conv;
28060 }
28061
28062 void  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_free"))) TS_CResult_ReceiveTlvsDecodeErrorZ_free(uint64_t _res) {
28063         if (!ptr_is_owned(_res)) return;
28064         void* _res_ptr = untag_ptr(_res);
28065         CHECK_ACCESS(_res_ptr);
28066         LDKCResult_ReceiveTlvsDecodeErrorZ _res_conv = *(LDKCResult_ReceiveTlvsDecodeErrorZ*)(_res_ptr);
28067         FREE(untag_ptr(_res));
28068         CResult_ReceiveTlvsDecodeErrorZ_free(_res_conv);
28069 }
28070
28071 static inline uint64_t CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR arg) {
28072         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28073         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(arg);
28074         return tag_ptr(ret_conv, true);
28075 }
28076 int64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_clone_ptr"))) TS_CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(uint64_t arg) {
28077         LDKCResult_ReceiveTlvsDecodeErrorZ* arg_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(arg);
28078         int64_t ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(arg_conv);
28079         return ret_conv;
28080 }
28081
28082 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_clone"))) TS_CResult_ReceiveTlvsDecodeErrorZ_clone(uint64_t orig) {
28083         LDKCResult_ReceiveTlvsDecodeErrorZ* orig_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(orig);
28084         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28085         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(orig_conv);
28086         return tag_ptr(ret_conv, true);
28087 }
28088
28089 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
28090         LDKPaymentRelay o_conv;
28091         o_conv.inner = untag_ptr(o);
28092         o_conv.is_owned = ptr_is_owned(o);
28093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28094         o_conv = PaymentRelay_clone(&o_conv);
28095         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28096         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
28097         return tag_ptr(ret_conv, true);
28098 }
28099
28100 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
28101         void* e_ptr = untag_ptr(e);
28102         CHECK_ACCESS(e_ptr);
28103         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28104         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28105         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28106         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
28107         return tag_ptr(ret_conv, true);
28108 }
28109
28110 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
28111         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
28112         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
28113         return ret_conv;
28114 }
28115
28116 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
28117         if (!ptr_is_owned(_res)) return;
28118         void* _res_ptr = untag_ptr(_res);
28119         CHECK_ACCESS(_res_ptr);
28120         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
28121         FREE(untag_ptr(_res));
28122         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
28123 }
28124
28125 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
28126         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28127         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
28128         return tag_ptr(ret_conv, true);
28129 }
28130 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
28131         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
28132         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
28133         return ret_conv;
28134 }
28135
28136 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
28137         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
28138         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28139         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
28140         return tag_ptr(ret_conv, true);
28141 }
28142
28143 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
28144         LDKPaymentConstraints o_conv;
28145         o_conv.inner = untag_ptr(o);
28146         o_conv.is_owned = ptr_is_owned(o);
28147         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28148         o_conv = PaymentConstraints_clone(&o_conv);
28149         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28150         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
28151         return tag_ptr(ret_conv, true);
28152 }
28153
28154 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
28155         void* e_ptr = untag_ptr(e);
28156         CHECK_ACCESS(e_ptr);
28157         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28158         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28159         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28160         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
28161         return tag_ptr(ret_conv, true);
28162 }
28163
28164 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
28165         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
28166         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
28167         return ret_conv;
28168 }
28169
28170 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
28171         if (!ptr_is_owned(_res)) return;
28172         void* _res_ptr = untag_ptr(_res);
28173         CHECK_ACCESS(_res_ptr);
28174         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
28175         FREE(untag_ptr(_res));
28176         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
28177 }
28178
28179 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
28180         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28181         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
28182         return tag_ptr(ret_conv, true);
28183 }
28184 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
28185         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
28186         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
28187         return ret_conv;
28188 }
28189
28190 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
28191         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
28192         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28193         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
28194         return tag_ptr(ret_conv, true);
28195 }
28196
28197 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_ok(int8_tArray o) {
28198         LDKThirtyTwoBytes o_ref;
28199         CHECK(o->arr_len == 32);
28200         memcpy(o_ref.data, o->elems, 32); FREE(o);
28201         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28202         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_ok(o_ref);
28203         return tag_ptr(ret_conv, true);
28204 }
28205
28206 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_err"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_err(uint64_t e) {
28207         void* e_ptr = untag_ptr(e);
28208         CHECK_ACCESS(e_ptr);
28209         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
28210         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
28211         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28212         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_err(e_conv);
28213         return tag_ptr(ret_conv, true);
28214 }
28215
28216 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(uint64_t o) {
28217         LDKCResult_ThirtyTwoBytesPaymentErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(o);
28218         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o_conv);
28219         return ret_conv;
28220 }
28221
28222 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_free"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_free(uint64_t _res) {
28223         if (!ptr_is_owned(_res)) return;
28224         void* _res_ptr = untag_ptr(_res);
28225         CHECK_ACCESS(_res_ptr);
28226         LDKCResult_ThirtyTwoBytesPaymentErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentErrorZ*)(_res_ptr);
28227         FREE(untag_ptr(_res));
28228         CResult_ThirtyTwoBytesPaymentErrorZ_free(_res_conv);
28229 }
28230
28231 static inline uint64_t CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR arg) {
28232         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28233         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(arg);
28234         return tag_ptr(ret_conv, true);
28235 }
28236 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(uint64_t arg) {
28237         LDKCResult_ThirtyTwoBytesPaymentErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(arg);
28238         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(arg_conv);
28239         return ret_conv;
28240 }
28241
28242 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone(uint64_t orig) {
28243         LDKCResult_ThirtyTwoBytesPaymentErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(orig);
28244         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28245         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig_conv);
28246         return tag_ptr(ret_conv, true);
28247 }
28248
28249 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
28250         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28251         *ret_conv = CResult_NonePaymentErrorZ_ok();
28252         return tag_ptr(ret_conv, true);
28253 }
28254
28255 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
28256         void* e_ptr = untag_ptr(e);
28257         CHECK_ACCESS(e_ptr);
28258         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
28259         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
28260         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28261         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
28262         return tag_ptr(ret_conv, true);
28263 }
28264
28265 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
28266         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
28267         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
28268         return ret_conv;
28269 }
28270
28271 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
28272         if (!ptr_is_owned(_res)) return;
28273         void* _res_ptr = untag_ptr(_res);
28274         CHECK_ACCESS(_res_ptr);
28275         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
28276         FREE(untag_ptr(_res));
28277         CResult_NonePaymentErrorZ_free(_res_conv);
28278 }
28279
28280 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
28281         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28282         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
28283         return tag_ptr(ret_conv, true);
28284 }
28285 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
28286         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
28287         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
28288         return ret_conv;
28289 }
28290
28291 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
28292         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
28293         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28294         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
28295         return tag_ptr(ret_conv, true);
28296 }
28297
28298 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(uint64_tArray o) {
28299         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
28300         o_constr.datalen = o->arr_len;
28301         if (o_constr.datalen > 0)
28302                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
28303         else
28304                 o_constr.data = NULL;
28305         uint64_t* o_vals = o->elems;
28306         for (size_t o = 0; o < o_constr.datalen; o++) {
28307                 uint64_t o_conv_40 = o_vals[o];
28308                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
28309                 CHECK_ACCESS(o_conv_40_ptr);
28310                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
28311                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
28312                 o_constr.data[o] = o_conv_40_conv;
28313         }
28314         FREE(o);
28315         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28316         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o_constr);
28317         return tag_ptr(ret_conv, true);
28318 }
28319
28320 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(uint64_t e) {
28321         void* e_ptr = untag_ptr(e);
28322         CHECK_ACCESS(e_ptr);
28323         LDKProbingError e_conv = *(LDKProbingError*)(e_ptr);
28324         e_conv = ProbingError_clone((LDKProbingError*)untag_ptr(e));
28325         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28326         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e_conv);
28327         return tag_ptr(ret_conv, true);
28328 }
28329
28330 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(uint64_t o) {
28331         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(o);
28332         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o_conv);
28333         return ret_conv;
28334 }
28335
28336 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(uint64_t _res) {
28337         if (!ptr_is_owned(_res)) return;
28338         void* _res_ptr = untag_ptr(_res);
28339         CHECK_ACCESS(_res_ptr);
28340         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)(_res_ptr);
28341         FREE(untag_ptr(_res));
28342         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res_conv);
28343 }
28344
28345 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR arg) {
28346         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28347         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(arg);
28348         return tag_ptr(ret_conv, true);
28349 }
28350 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(uint64_t arg) {
28351         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(arg);
28352         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(arg_conv);
28353         return ret_conv;
28354 }
28355
28356 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(uint64_t orig) {
28357         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(orig);
28358         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28359         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig_conv);
28360         return tag_ptr(ret_conv, true);
28361 }
28362
28363 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
28364         LDKStr o_conv = str_ref_to_owned_c(o);
28365         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28366         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
28367         return tag_ptr(ret_conv, true);
28368 }
28369
28370 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
28371         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
28372         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28373         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
28374         return tag_ptr(ret_conv, true);
28375 }
28376
28377 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
28378         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
28379         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
28380         return ret_conv;
28381 }
28382
28383 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
28384         if (!ptr_is_owned(_res)) return;
28385         void* _res_ptr = untag_ptr(_res);
28386         CHECK_ACCESS(_res_ptr);
28387         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
28388         FREE(untag_ptr(_res));
28389         CResult_StrSecp256k1ErrorZ_free(_res_conv);
28390 }
28391
28392 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
28393         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28394         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
28395         return tag_ptr(ret_conv, true);
28396 }
28397 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
28398         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
28399         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
28400         return ret_conv;
28401 }
28402
28403 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
28404         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
28405         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28406         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
28407         return tag_ptr(ret_conv, true);
28408 }
28409
28410 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
28411         void* o_ptr = untag_ptr(o);
28412         CHECK_ACCESS(o_ptr);
28413         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
28414         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
28415         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28416         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
28417         return tag_ptr(ret_conv, true);
28418 }
28419
28420 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
28421         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
28422         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28423         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
28424         return tag_ptr(ret_conv, true);
28425 }
28426
28427 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
28428         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
28429         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
28430         return ret_conv;
28431 }
28432
28433 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
28434         if (!ptr_is_owned(_res)) return;
28435         void* _res_ptr = untag_ptr(_res);
28436         CHECK_ACCESS(_res_ptr);
28437         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
28438         FREE(untag_ptr(_res));
28439         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
28440 }
28441
28442 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
28443         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28444         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
28445         return tag_ptr(ret_conv, true);
28446 }
28447 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
28448         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
28449         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
28450         return ret_conv;
28451 }
28452
28453 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
28454         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
28455         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28456         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
28457         return tag_ptr(ret_conv, true);
28458 }
28459
28460 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
28461         LDKOnionMessagePath o_conv;
28462         o_conv.inner = untag_ptr(o);
28463         o_conv.is_owned = ptr_is_owned(o);
28464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28465         o_conv = OnionMessagePath_clone(&o_conv);
28466         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28467         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
28468         return tag_ptr(ret_conv, true);
28469 }
28470
28471 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
28472         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28473         *ret_conv = CResult_OnionMessagePathNoneZ_err();
28474         return tag_ptr(ret_conv, true);
28475 }
28476
28477 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
28478         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
28479         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
28480         return ret_conv;
28481 }
28482
28483 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
28484         if (!ptr_is_owned(_res)) return;
28485         void* _res_ptr = untag_ptr(_res);
28486         CHECK_ACCESS(_res_ptr);
28487         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
28488         FREE(untag_ptr(_res));
28489         CResult_OnionMessagePathNoneZ_free(_res_conv);
28490 }
28491
28492 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
28493         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28494         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
28495         return tag_ptr(ret_conv, true);
28496 }
28497 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
28498         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
28499         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
28500         return ret_conv;
28501 }
28502
28503 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
28504         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
28505         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28506         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
28507         return tag_ptr(ret_conv, true);
28508 }
28509
28510 static inline uint64_t C2Tuple_PublicKeyOnionMessageZ_clone_ptr(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR arg) {
28511         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28512         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(arg);
28513         return tag_ptr(ret_conv, true);
28514 }
28515 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_clone_ptr"))) TS_C2Tuple_PublicKeyOnionMessageZ_clone_ptr(uint64_t arg) {
28516         LDKC2Tuple_PublicKeyOnionMessageZ* arg_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(arg);
28517         int64_t ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone_ptr(arg_conv);
28518         return ret_conv;
28519 }
28520
28521 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_clone"))) TS_C2Tuple_PublicKeyOnionMessageZ_clone(uint64_t orig) {
28522         LDKC2Tuple_PublicKeyOnionMessageZ* orig_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(orig);
28523         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28524         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(orig_conv);
28525         return tag_ptr(ret_conv, true);
28526 }
28527
28528 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_new"))) TS_C2Tuple_PublicKeyOnionMessageZ_new(int8_tArray a, uint64_t b) {
28529         LDKPublicKey a_ref;
28530         CHECK(a->arr_len == 33);
28531         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
28532         LDKOnionMessage b_conv;
28533         b_conv.inner = untag_ptr(b);
28534         b_conv.is_owned = ptr_is_owned(b);
28535         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28536         b_conv = OnionMessage_clone(&b_conv);
28537         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28538         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_new(a_ref, b_conv);
28539         return tag_ptr(ret_conv, true);
28540 }
28541
28542 void  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_free"))) TS_C2Tuple_PublicKeyOnionMessageZ_free(uint64_t _res) {
28543         if (!ptr_is_owned(_res)) return;
28544         void* _res_ptr = untag_ptr(_res);
28545         CHECK_ACCESS(_res_ptr);
28546         LDKC2Tuple_PublicKeyOnionMessageZ _res_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(_res_ptr);
28547         FREE(untag_ptr(_res));
28548         C2Tuple_PublicKeyOnionMessageZ_free(_res_conv);
28549 }
28550
28551 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(uint64_t o) {
28552         void* o_ptr = untag_ptr(o);
28553         CHECK_ACCESS(o_ptr);
28554         LDKC2Tuple_PublicKeyOnionMessageZ o_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(o_ptr);
28555         o_conv = C2Tuple_PublicKeyOnionMessageZ_clone((LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(o));
28556         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
28557         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o_conv);
28558         return tag_ptr(ret_conv, true);
28559 }
28560
28561 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(uint64_t e) {
28562         void* e_ptr = untag_ptr(e);
28563         CHECK_ACCESS(e_ptr);
28564         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
28565         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
28566         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
28567         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e_conv);
28568         return tag_ptr(ret_conv, true);
28569 }
28570
28571 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(uint64_t o) {
28572         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* o_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(o);
28573         jboolean ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o_conv);
28574         return ret_conv;
28575 }
28576
28577 void  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(uint64_t _res) {
28578         if (!ptr_is_owned(_res)) return;
28579         void* _res_ptr = untag_ptr(_res);
28580         CHECK_ACCESS(_res_ptr);
28581         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res_conv = *(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)(_res_ptr);
28582         FREE(untag_ptr(_res));
28583         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv);
28584 }
28585
28586 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
28587         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
28588         *ret_conv = CResult_NoneSendErrorZ_ok();
28589         return tag_ptr(ret_conv, true);
28590 }
28591
28592 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
28593         void* e_ptr = untag_ptr(e);
28594         CHECK_ACCESS(e_ptr);
28595         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
28596         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
28597         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
28598         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
28599         return tag_ptr(ret_conv, true);
28600 }
28601
28602 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
28603         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
28604         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
28605         return ret_conv;
28606 }
28607
28608 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
28609         if (!ptr_is_owned(_res)) return;
28610         void* _res_ptr = untag_ptr(_res);
28611         CHECK_ACCESS(_res_ptr);
28612         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
28613         FREE(untag_ptr(_res));
28614         CResult_NoneSendErrorZ_free(_res_conv);
28615 }
28616
28617 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
28618         LDKBlindedPath o_conv;
28619         o_conv.inner = untag_ptr(o);
28620         o_conv.is_owned = ptr_is_owned(o);
28621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28622         o_conv = BlindedPath_clone(&o_conv);
28623         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
28624         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
28625         return tag_ptr(ret_conv, true);
28626 }
28627
28628 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
28629         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
28630         *ret_conv = CResult_BlindedPathNoneZ_err();
28631         return tag_ptr(ret_conv, true);
28632 }
28633
28634 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
28635         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
28636         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
28637         return ret_conv;
28638 }
28639
28640 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
28641         if (!ptr_is_owned(_res)) return;
28642         void* _res_ptr = untag_ptr(_res);
28643         CHECK_ACCESS(_res_ptr);
28644         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
28645         FREE(untag_ptr(_res));
28646         CResult_BlindedPathNoneZ_free(_res_conv);
28647 }
28648
28649 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
28650         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
28651         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
28652         return tag_ptr(ret_conv, true);
28653 }
28654 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
28655         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
28656         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
28657         return ret_conv;
28658 }
28659
28660 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
28661         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
28662         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
28663         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
28664         return tag_ptr(ret_conv, true);
28665 }
28666
28667 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
28668         void* o_ptr = untag_ptr(o);
28669         CHECK_ACCESS(o_ptr);
28670         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
28671         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
28672         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
28673         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
28674         return tag_ptr(ret_conv, true);
28675 }
28676
28677 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
28678         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
28679         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
28680         return tag_ptr(ret_conv, true);
28681 }
28682
28683 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
28684         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
28685         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
28686         return ret_conv;
28687 }
28688
28689 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
28690         if (!ptr_is_owned(_res)) return;
28691         void* _res_ptr = untag_ptr(_res);
28692         CHECK_ACCESS(_res_ptr);
28693         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
28694         FREE(untag_ptr(_res));
28695         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
28696 }
28697
28698 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
28699         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
28700         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
28701         return tag_ptr(ret_conv, true);
28702 }
28703 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
28704         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
28705         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
28706         return ret_conv;
28707 }
28708
28709 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
28710         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
28711         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
28712         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
28713         return tag_ptr(ret_conv, true);
28714 }
28715
28716 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
28717         LDKBlindedPath o_conv;
28718         o_conv.inner = untag_ptr(o);
28719         o_conv.is_owned = ptr_is_owned(o);
28720         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28721         o_conv = BlindedPath_clone(&o_conv);
28722         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
28723         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
28724         return tag_ptr(ret_conv, true);
28725 }
28726
28727 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
28728         void* e_ptr = untag_ptr(e);
28729         CHECK_ACCESS(e_ptr);
28730         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28731         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28732         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
28733         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
28734         return tag_ptr(ret_conv, true);
28735 }
28736
28737 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
28738         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
28739         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
28740         return ret_conv;
28741 }
28742
28743 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
28744         if (!ptr_is_owned(_res)) return;
28745         void* _res_ptr = untag_ptr(_res);
28746         CHECK_ACCESS(_res_ptr);
28747         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
28748         FREE(untag_ptr(_res));
28749         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
28750 }
28751
28752 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
28753         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
28754         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
28755         return tag_ptr(ret_conv, true);
28756 }
28757 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
28758         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
28759         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
28760         return ret_conv;
28761 }
28762
28763 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
28764         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
28765         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
28766         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
28767         return tag_ptr(ret_conv, true);
28768 }
28769
28770 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
28771         LDKBlindedHop o_conv;
28772         o_conv.inner = untag_ptr(o);
28773         o_conv.is_owned = ptr_is_owned(o);
28774         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28775         o_conv = BlindedHop_clone(&o_conv);
28776         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
28777         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
28778         return tag_ptr(ret_conv, true);
28779 }
28780
28781 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
28782         void* e_ptr = untag_ptr(e);
28783         CHECK_ACCESS(e_ptr);
28784         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28785         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28786         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
28787         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
28788         return tag_ptr(ret_conv, true);
28789 }
28790
28791 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
28792         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
28793         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
28794         return ret_conv;
28795 }
28796
28797 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
28798         if (!ptr_is_owned(_res)) return;
28799         void* _res_ptr = untag_ptr(_res);
28800         CHECK_ACCESS(_res_ptr);
28801         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
28802         FREE(untag_ptr(_res));
28803         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
28804 }
28805
28806 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
28807         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
28808         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
28809         return tag_ptr(ret_conv, true);
28810 }
28811 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
28812         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
28813         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
28814         return ret_conv;
28815 }
28816
28817 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
28818         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
28819         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
28820         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
28821         return tag_ptr(ret_conv, true);
28822 }
28823
28824 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
28825         LDKInvoiceError o_conv;
28826         o_conv.inner = untag_ptr(o);
28827         o_conv.is_owned = ptr_is_owned(o);
28828         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28829         o_conv = InvoiceError_clone(&o_conv);
28830         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
28831         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
28832         return tag_ptr(ret_conv, true);
28833 }
28834
28835 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
28836         void* e_ptr = untag_ptr(e);
28837         CHECK_ACCESS(e_ptr);
28838         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28839         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28840         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
28841         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
28842         return tag_ptr(ret_conv, true);
28843 }
28844
28845 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
28846         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
28847         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
28848         return ret_conv;
28849 }
28850
28851 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
28852         if (!ptr_is_owned(_res)) return;
28853         void* _res_ptr = untag_ptr(_res);
28854         CHECK_ACCESS(_res_ptr);
28855         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
28856         FREE(untag_ptr(_res));
28857         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
28858 }
28859
28860 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
28861         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
28862         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
28863         return tag_ptr(ret_conv, true);
28864 }
28865 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
28866         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
28867         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
28868         return ret_conv;
28869 }
28870
28871 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
28872         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
28873         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
28874         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
28875         return tag_ptr(ret_conv, true);
28876 }
28877
28878 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
28879         void* o_ptr = untag_ptr(o);
28880         CHECK_ACCESS(o_ptr);
28881         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
28882         if (o_conv.free == LDKFilter_JCalls_free) {
28883                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28884                 LDKFilter_JCalls_cloned(&o_conv);
28885         }
28886         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
28887         *ret_copy = COption_FilterZ_some(o_conv);
28888         uint64_t ret_ref = tag_ptr(ret_copy, true);
28889         return ret_ref;
28890 }
28891
28892 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
28893         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
28894         *ret_copy = COption_FilterZ_none();
28895         uint64_t ret_ref = tag_ptr(ret_copy, true);
28896         return ret_ref;
28897 }
28898
28899 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
28900         if (!ptr_is_owned(_res)) return;
28901         void* _res_ptr = untag_ptr(_res);
28902         CHECK_ACCESS(_res_ptr);
28903         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
28904         FREE(untag_ptr(_res));
28905         COption_FilterZ_free(_res_conv);
28906 }
28907
28908 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
28909         LDKLockedChannelMonitor o_conv;
28910         o_conv.inner = untag_ptr(o);
28911         o_conv.is_owned = ptr_is_owned(o);
28912         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28913         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
28914         
28915         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
28916         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
28917         return tag_ptr(ret_conv, true);
28918 }
28919
28920 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
28921         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
28922         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
28923         return tag_ptr(ret_conv, true);
28924 }
28925
28926 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
28927         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
28928         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
28929         return ret_conv;
28930 }
28931
28932 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
28933         if (!ptr_is_owned(_res)) return;
28934         void* _res_ptr = untag_ptr(_res);
28935         CHECK_ACCESS(_res_ptr);
28936         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
28937         FREE(untag_ptr(_res));
28938         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
28939 }
28940
28941 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
28942         LDKCVec_OutPointZ _res_constr;
28943         _res_constr.datalen = _res->arr_len;
28944         if (_res_constr.datalen > 0)
28945                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
28946         else
28947                 _res_constr.data = NULL;
28948         uint64_t* _res_vals = _res->elems;
28949         for (size_t k = 0; k < _res_constr.datalen; k++) {
28950                 uint64_t _res_conv_10 = _res_vals[k];
28951                 LDKOutPoint _res_conv_10_conv;
28952                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
28953                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
28954                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
28955                 _res_constr.data[k] = _res_conv_10_conv;
28956         }
28957         FREE(_res);
28958         CVec_OutPointZ_free(_res_constr);
28959 }
28960
28961 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
28962         LDKCVec_MonitorUpdateIdZ _res_constr;
28963         _res_constr.datalen = _res->arr_len;
28964         if (_res_constr.datalen > 0)
28965                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
28966         else
28967                 _res_constr.data = NULL;
28968         uint64_t* _res_vals = _res->elems;
28969         for (size_t r = 0; r < _res_constr.datalen; r++) {
28970                 uint64_t _res_conv_17 = _res_vals[r];
28971                 LDKMonitorUpdateId _res_conv_17_conv;
28972                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
28973                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
28974                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
28975                 _res_constr.data[r] = _res_conv_17_conv;
28976         }
28977         FREE(_res);
28978         CVec_MonitorUpdateIdZ_free(_res_constr);
28979 }
28980
28981 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
28982         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
28983         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
28984         return tag_ptr(ret_conv, true);
28985 }
28986 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
28987         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
28988         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
28989         return ret_conv;
28990 }
28991
28992 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
28993         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
28994         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
28995         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
28996         return tag_ptr(ret_conv, true);
28997 }
28998
28999 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
29000         LDKOutPoint a_conv;
29001         a_conv.inner = untag_ptr(a);
29002         a_conv.is_owned = ptr_is_owned(a);
29003         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29004         a_conv = OutPoint_clone(&a_conv);
29005         LDKCVec_MonitorUpdateIdZ b_constr;
29006         b_constr.datalen = b->arr_len;
29007         if (b_constr.datalen > 0)
29008                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
29009         else
29010                 b_constr.data = NULL;
29011         uint64_t* b_vals = b->elems;
29012         for (size_t r = 0; r < b_constr.datalen; r++) {
29013                 uint64_t b_conv_17 = b_vals[r];
29014                 LDKMonitorUpdateId b_conv_17_conv;
29015                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
29016                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
29017                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
29018                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
29019                 b_constr.data[r] = b_conv_17_conv;
29020         }
29021         FREE(b);
29022         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29023         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
29024         return tag_ptr(ret_conv, true);
29025 }
29026
29027 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
29028         if (!ptr_is_owned(_res)) return;
29029         void* _res_ptr = untag_ptr(_res);
29030         CHECK_ACCESS(_res_ptr);
29031         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
29032         FREE(untag_ptr(_res));
29033         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
29034 }
29035
29036 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
29037         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
29038         _res_constr.datalen = _res->arr_len;
29039         if (_res_constr.datalen > 0)
29040                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
29041         else
29042                 _res_constr.data = NULL;
29043         uint64_t* _res_vals = _res->elems;
29044         for (size_t p = 0; p < _res_constr.datalen; p++) {
29045                 uint64_t _res_conv_41 = _res_vals[p];
29046                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
29047                 CHECK_ACCESS(_res_conv_41_ptr);
29048                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
29049                 FREE(untag_ptr(_res_conv_41));
29050                 _res_constr.data[p] = _res_conv_41_conv;
29051         }
29052         FREE(_res);
29053         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
29054 }
29055
29056 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
29057         if (!ptr_is_owned(this_ptr)) return;
29058         void* this_ptr_ptr = untag_ptr(this_ptr);
29059         CHECK_ACCESS(this_ptr_ptr);
29060         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
29061         FREE(untag_ptr(this_ptr));
29062         APIError_free(this_ptr_conv);
29063 }
29064
29065 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
29066         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29067         *ret_copy = APIError_clone(arg);
29068         uint64_t ret_ref = tag_ptr(ret_copy, true);
29069         return ret_ref;
29070 }
29071 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
29072         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
29073         int64_t ret_conv = APIError_clone_ptr(arg_conv);
29074         return ret_conv;
29075 }
29076
29077 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
29078         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
29079         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29080         *ret_copy = APIError_clone(orig_conv);
29081         uint64_t ret_ref = tag_ptr(ret_copy, true);
29082         return ret_ref;
29083 }
29084
29085 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
29086         LDKStr err_conv = str_ref_to_owned_c(err);
29087         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29088         *ret_copy = APIError_apimisuse_error(err_conv);
29089         uint64_t ret_ref = tag_ptr(ret_copy, true);
29090         return ret_ref;
29091 }
29092
29093 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
29094         LDKStr err_conv = str_ref_to_owned_c(err);
29095         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29096         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
29097         uint64_t ret_ref = tag_ptr(ret_copy, true);
29098         return ret_ref;
29099 }
29100
29101 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
29102         LDKStr err_conv = str_ref_to_owned_c(err);
29103         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29104         *ret_copy = APIError_invalid_route(err_conv);
29105         uint64_t ret_ref = tag_ptr(ret_copy, true);
29106         return ret_ref;
29107 }
29108
29109 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
29110         LDKStr err_conv = str_ref_to_owned_c(err);
29111         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29112         *ret_copy = APIError_channel_unavailable(err_conv);
29113         uint64_t ret_ref = tag_ptr(ret_copy, true);
29114         return ret_ref;
29115 }
29116
29117 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
29118         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29119         *ret_copy = APIError_monitor_update_in_progress();
29120         uint64_t ret_ref = tag_ptr(ret_copy, true);
29121         return ret_ref;
29122 }
29123
29124 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
29125         LDKShutdownScript script_conv;
29126         script_conv.inner = untag_ptr(script);
29127         script_conv.is_owned = ptr_is_owned(script);
29128         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
29129         script_conv = ShutdownScript_clone(&script_conv);
29130         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29131         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
29132         uint64_t ret_ref = tag_ptr(ret_copy, true);
29133         return ret_ref;
29134 }
29135
29136 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
29137         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
29138         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
29139         jboolean ret_conv = APIError_eq(a_conv, b_conv);
29140         return ret_conv;
29141 }
29142
29143 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
29144         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
29145         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
29146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29148         CVec_u8Z_free(ret_var);
29149         return ret_arr;
29150 }
29151
29152 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
29153         LDKu8slice ser_ref;
29154         ser_ref.datalen = ser->arr_len;
29155         ser_ref.data = ser->elems;
29156         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
29157         *ret_conv = APIError_read(ser_ref);
29158         FREE(ser);
29159         return tag_ptr(ret_conv, true);
29160 }
29161
29162 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
29163         LDKBigSize this_obj_conv;
29164         this_obj_conv.inner = untag_ptr(this_obj);
29165         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29167         BigSize_free(this_obj_conv);
29168 }
29169
29170 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
29171         LDKBigSize this_ptr_conv;
29172         this_ptr_conv.inner = untag_ptr(this_ptr);
29173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29175         this_ptr_conv.is_owned = false;
29176         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
29177         return ret_conv;
29178 }
29179
29180 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
29181         LDKBigSize this_ptr_conv;
29182         this_ptr_conv.inner = untag_ptr(this_ptr);
29183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29185         this_ptr_conv.is_owned = false;
29186         BigSize_set_a(&this_ptr_conv, val);
29187 }
29188
29189 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
29190         LDKBigSize ret_var = BigSize_new(a_arg);
29191         uint64_t ret_ref = 0;
29192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29194         return ret_ref;
29195 }
29196
29197 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
29198         LDKBigSize ret_var = BigSize_clone(arg);
29199         uint64_t ret_ref = 0;
29200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29202         return ret_ref;
29203 }
29204 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
29205         LDKBigSize arg_conv;
29206         arg_conv.inner = untag_ptr(arg);
29207         arg_conv.is_owned = ptr_is_owned(arg);
29208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29209         arg_conv.is_owned = false;
29210         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
29211         return ret_conv;
29212 }
29213
29214 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
29215         LDKBigSize orig_conv;
29216         orig_conv.inner = untag_ptr(orig);
29217         orig_conv.is_owned = ptr_is_owned(orig);
29218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29219         orig_conv.is_owned = false;
29220         LDKBigSize ret_var = BigSize_clone(&orig_conv);
29221         uint64_t ret_ref = 0;
29222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29224         return ret_ref;
29225 }
29226
29227 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
29228         LDKBigSize o_conv;
29229         o_conv.inner = untag_ptr(o);
29230         o_conv.is_owned = ptr_is_owned(o);
29231         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29232         o_conv.is_owned = false;
29233         int64_t ret_conv = BigSize_hash(&o_conv);
29234         return ret_conv;
29235 }
29236
29237 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
29238         LDKBigSize a_conv;
29239         a_conv.inner = untag_ptr(a);
29240         a_conv.is_owned = ptr_is_owned(a);
29241         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29242         a_conv.is_owned = false;
29243         LDKBigSize b_conv;
29244         b_conv.inner = untag_ptr(b);
29245         b_conv.is_owned = ptr_is_owned(b);
29246         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29247         b_conv.is_owned = false;
29248         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
29249         return ret_conv;
29250 }
29251
29252 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
29253         LDKBigSize obj_conv;
29254         obj_conv.inner = untag_ptr(obj);
29255         obj_conv.is_owned = ptr_is_owned(obj);
29256         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29257         obj_conv.is_owned = false;
29258         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
29259         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29260         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29261         CVec_u8Z_free(ret_var);
29262         return ret_arr;
29263 }
29264
29265 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
29266         LDKu8slice ser_ref;
29267         ser_ref.datalen = ser->arr_len;
29268         ser_ref.data = ser->elems;
29269         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
29270         *ret_conv = BigSize_read(ser_ref);
29271         FREE(ser);
29272         return tag_ptr(ret_conv, true);
29273 }
29274
29275 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
29276         LDKHostname this_obj_conv;
29277         this_obj_conv.inner = untag_ptr(this_obj);
29278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29280         Hostname_free(this_obj_conv);
29281 }
29282
29283 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
29284         LDKHostname ret_var = Hostname_clone(arg);
29285         uint64_t ret_ref = 0;
29286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29288         return ret_ref;
29289 }
29290 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
29291         LDKHostname arg_conv;
29292         arg_conv.inner = untag_ptr(arg);
29293         arg_conv.is_owned = ptr_is_owned(arg);
29294         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29295         arg_conv.is_owned = false;
29296         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
29297         return ret_conv;
29298 }
29299
29300 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
29301         LDKHostname orig_conv;
29302         orig_conv.inner = untag_ptr(orig);
29303         orig_conv.is_owned = ptr_is_owned(orig);
29304         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29305         orig_conv.is_owned = false;
29306         LDKHostname ret_var = Hostname_clone(&orig_conv);
29307         uint64_t ret_ref = 0;
29308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29310         return ret_ref;
29311 }
29312
29313 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
29314         LDKHostname a_conv;
29315         a_conv.inner = untag_ptr(a);
29316         a_conv.is_owned = ptr_is_owned(a);
29317         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29318         a_conv.is_owned = false;
29319         LDKHostname b_conv;
29320         b_conv.inner = untag_ptr(b);
29321         b_conv.is_owned = ptr_is_owned(b);
29322         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29323         b_conv.is_owned = false;
29324         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
29325         return ret_conv;
29326 }
29327
29328 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
29329         LDKHostname this_arg_conv;
29330         this_arg_conv.inner = untag_ptr(this_arg);
29331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29333         this_arg_conv.is_owned = false;
29334         int8_t ret_conv = Hostname_len(&this_arg_conv);
29335         return ret_conv;
29336 }
29337
29338 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
29339         LDKHostname obj_conv;
29340         obj_conv.inner = untag_ptr(obj);
29341         obj_conv.is_owned = ptr_is_owned(obj);
29342         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29343         obj_conv.is_owned = false;
29344         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
29345         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29346         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29347         CVec_u8Z_free(ret_var);
29348         return ret_arr;
29349 }
29350
29351 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
29352         LDKu8slice ser_ref;
29353         ser_ref.datalen = ser->arr_len;
29354         ser_ref.data = ser->elems;
29355         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
29356         *ret_conv = Hostname_read(ser_ref);
29357         FREE(ser);
29358         return tag_ptr(ret_conv, true);
29359 }
29360
29361 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
29362         LDKTransactionU16LenLimited this_obj_conv;
29363         this_obj_conv.inner = untag_ptr(this_obj);
29364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29366         TransactionU16LenLimited_free(this_obj_conv);
29367 }
29368
29369 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
29370         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
29371         uint64_t ret_ref = 0;
29372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29374         return ret_ref;
29375 }
29376 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
29377         LDKTransactionU16LenLimited arg_conv;
29378         arg_conv.inner = untag_ptr(arg);
29379         arg_conv.is_owned = ptr_is_owned(arg);
29380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29381         arg_conv.is_owned = false;
29382         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
29383         return ret_conv;
29384 }
29385
29386 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
29387         LDKTransactionU16LenLimited orig_conv;
29388         orig_conv.inner = untag_ptr(orig);
29389         orig_conv.is_owned = ptr_is_owned(orig);
29390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29391         orig_conv.is_owned = false;
29392         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
29393         uint64_t ret_ref = 0;
29394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29396         return ret_ref;
29397 }
29398
29399 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
29400         LDKTransactionU16LenLimited a_conv;
29401         a_conv.inner = untag_ptr(a);
29402         a_conv.is_owned = ptr_is_owned(a);
29403         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29404         a_conv.is_owned = false;
29405         LDKTransactionU16LenLimited b_conv;
29406         b_conv.inner = untag_ptr(b);
29407         b_conv.is_owned = ptr_is_owned(b);
29408         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29409         b_conv.is_owned = false;
29410         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
29411         return ret_conv;
29412 }
29413
29414 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
29415         LDKTransaction transaction_ref;
29416         transaction_ref.datalen = transaction->arr_len;
29417         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
29418         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
29419         transaction_ref.data_is_owned = true;
29420         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
29421         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
29422         return tag_ptr(ret_conv, true);
29423 }
29424
29425 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
29426         LDKTransactionU16LenLimited this_arg_conv;
29427         this_arg_conv.inner = untag_ptr(this_arg);
29428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29430         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
29431         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
29432         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29433         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29434         Transaction_free(ret_var);
29435         return ret_arr;
29436 }
29437
29438 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
29439         LDKTransactionU16LenLimited obj_conv;
29440         obj_conv.inner = untag_ptr(obj);
29441         obj_conv.is_owned = ptr_is_owned(obj);
29442         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29443         obj_conv.is_owned = false;
29444         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
29445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29447         CVec_u8Z_free(ret_var);
29448         return ret_arr;
29449 }
29450
29451 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
29452         LDKu8slice ser_ref;
29453         ser_ref.datalen = ser->arr_len;
29454         ser_ref.data = ser->elems;
29455         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
29456         *ret_conv = TransactionU16LenLimited_read(ser_ref);
29457         FREE(ser);
29458         return tag_ptr(ret_conv, true);
29459 }
29460
29461 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
29462         LDKu8slice msg_ref;
29463         msg_ref.datalen = msg->arr_len;
29464         msg_ref.data = msg->elems;
29465         uint8_t sk_arr[32];
29466         CHECK(sk->arr_len == 32);
29467         memcpy(sk_arr, sk->elems, 32); FREE(sk);
29468         uint8_t (*sk_ref)[32] = &sk_arr;
29469         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
29470         *ret_conv = sign(msg_ref, sk_ref);
29471         FREE(msg);
29472         return tag_ptr(ret_conv, true);
29473 }
29474
29475 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
29476         LDKu8slice msg_ref;
29477         msg_ref.datalen = msg->arr_len;
29478         msg_ref.data = msg->elems;
29479         LDKStr sig_conv = str_ref_to_owned_c(sig);
29480         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
29481         *ret_conv = recover_pk(msg_ref, sig_conv);
29482         FREE(msg);
29483         return tag_ptr(ret_conv, true);
29484 }
29485
29486 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
29487         LDKu8slice msg_ref;
29488         msg_ref.datalen = msg->arr_len;
29489         msg_ref.data = msg->elems;
29490         LDKStr sig_conv = str_ref_to_owned_c(sig);
29491         LDKPublicKey pk_ref;
29492         CHECK(pk->arr_len == 33);
29493         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
29494         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
29495         FREE(msg);
29496         return ret_conv;
29497 }
29498
29499 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
29500         LDKu8slice hrp_bytes_ref;
29501         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
29502         hrp_bytes_ref.data = hrp_bytes->elems;
29503         LDKCVec_U5Z data_without_signature_constr;
29504         data_without_signature_constr.datalen = data_without_signature->arr_len;
29505         if (data_without_signature_constr.datalen > 0)
29506                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
29507         else
29508                 data_without_signature_constr.data = NULL;
29509         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
29510         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
29511                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
29512                 
29513                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
29514         }
29515         FREE(data_without_signature);
29516         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
29517         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29518         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29519         CVec_u8Z_free(ret_var);
29520         FREE(hrp_bytes);
29521         return ret_arr;
29522 }
29523
29524 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
29525         if (!ptr_is_owned(this_ptr)) return;
29526         void* this_ptr_ptr = untag_ptr(this_ptr);
29527         CHECK_ACCESS(this_ptr_ptr);
29528         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
29529         FREE(untag_ptr(this_ptr));
29530         KVStore_free(this_ptr_conv);
29531 }
29532
29533 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
29534         if (!ptr_is_owned(this_ptr)) return;
29535         void* this_ptr_ptr = untag_ptr(this_ptr);
29536         CHECK_ACCESS(this_ptr_ptr);
29537         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
29538         FREE(untag_ptr(this_ptr));
29539         Persister_free(this_ptr_conv);
29540 }
29541
29542 uint64_t  __attribute__((export_name("TS_read_channel_monitors"))) TS_read_channel_monitors(uint64_t kv_store, uint64_t entropy_source, uint64_t signer_provider) {
29543         void* kv_store_ptr = untag_ptr(kv_store);
29544         CHECK_ACCESS(kv_store_ptr);
29545         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
29546         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
29547                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29548                 LDKKVStore_JCalls_cloned(&kv_store_conv);
29549         }
29550         void* entropy_source_ptr = untag_ptr(entropy_source);
29551         CHECK_ACCESS(entropy_source_ptr);
29552         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
29553         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
29554                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29555                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
29556         }
29557         void* signer_provider_ptr = untag_ptr(signer_provider);
29558         CHECK_ACCESS(signer_provider_ptr);
29559         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
29560         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
29561                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29562                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
29563         }
29564         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
29565         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
29566         return tag_ptr(ret_conv, true);
29567 }
29568
29569 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
29570         LDKMonitorUpdatingPersister this_obj_conv;
29571         this_obj_conv.inner = untag_ptr(this_obj);
29572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29574         MonitorUpdatingPersister_free(this_obj_conv);
29575 }
29576
29577 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_new"))) TS_MonitorUpdatingPersister_new(uint64_t kv_store, uint64_t logger, int64_t maximum_pending_updates, uint64_t entropy_source, uint64_t signer_provider) {
29578         void* kv_store_ptr = untag_ptr(kv_store);
29579         CHECK_ACCESS(kv_store_ptr);
29580         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
29581         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
29582                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29583                 LDKKVStore_JCalls_cloned(&kv_store_conv);
29584         }
29585         void* logger_ptr = untag_ptr(logger);
29586         CHECK_ACCESS(logger_ptr);
29587         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29588         if (logger_conv.free == LDKLogger_JCalls_free) {
29589                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29590                 LDKLogger_JCalls_cloned(&logger_conv);
29591         }
29592         void* entropy_source_ptr = untag_ptr(entropy_source);
29593         CHECK_ACCESS(entropy_source_ptr);
29594         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
29595         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
29596                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29597                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
29598         }
29599         void* signer_provider_ptr = untag_ptr(signer_provider);
29600         CHECK_ACCESS(signer_provider_ptr);
29601         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
29602         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
29603                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29604                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
29605         }
29606         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
29607         uint64_t ret_ref = 0;
29608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29610         return ret_ref;
29611 }
29612
29613 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_read_all_channel_monitors_with_updates"))) TS_MonitorUpdatingPersister_read_all_channel_monitors_with_updates(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator) {
29614         LDKMonitorUpdatingPersister this_arg_conv;
29615         this_arg_conv.inner = untag_ptr(this_arg);
29616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29618         this_arg_conv.is_owned = false;
29619         void* broadcaster_ptr = untag_ptr(broadcaster);
29620         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
29621         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
29622         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29623         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
29624         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
29625         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
29626         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
29627         return tag_ptr(ret_conv, true);
29628 }
29629
29630 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_read_channel_monitor_with_updates"))) TS_MonitorUpdatingPersister_read_channel_monitor_with_updates(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator, jstring monitor_key) {
29631         LDKMonitorUpdatingPersister this_arg_conv;
29632         this_arg_conv.inner = untag_ptr(this_arg);
29633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29635         this_arg_conv.is_owned = false;
29636         void* broadcaster_ptr = untag_ptr(broadcaster);
29637         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
29638         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
29639         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29640         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
29641         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
29642         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
29643         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
29644         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
29645         return tag_ptr(ret_conv, true);
29646 }
29647
29648 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
29649         LDKMonitorUpdatingPersister this_arg_conv;
29650         this_arg_conv.inner = untag_ptr(this_arg);
29651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29653         this_arg_conv.is_owned = false;
29654         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
29655         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
29656         return tag_ptr(ret_conv, true);
29657 }
29658
29659 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
29660         LDKMonitorUpdatingPersister this_arg_conv;
29661         this_arg_conv.inner = untag_ptr(this_arg);
29662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29664         this_arg_conv.is_owned = false;
29665         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
29666         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
29667         return tag_ptr(ret_ret, true);
29668 }
29669
29670 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
29671         LDKUntrustedString this_obj_conv;
29672         this_obj_conv.inner = untag_ptr(this_obj);
29673         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29675         UntrustedString_free(this_obj_conv);
29676 }
29677
29678 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
29679         LDKUntrustedString this_ptr_conv;
29680         this_ptr_conv.inner = untag_ptr(this_ptr);
29681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29683         this_ptr_conv.is_owned = false;
29684         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
29685         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29686         Str_free(ret_str);
29687         return ret_conv;
29688 }
29689
29690 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
29691         LDKUntrustedString this_ptr_conv;
29692         this_ptr_conv.inner = untag_ptr(this_ptr);
29693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29695         this_ptr_conv.is_owned = false;
29696         LDKStr val_conv = str_ref_to_owned_c(val);
29697         UntrustedString_set_a(&this_ptr_conv, val_conv);
29698 }
29699
29700 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
29701         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
29702         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
29703         uint64_t ret_ref = 0;
29704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29706         return ret_ref;
29707 }
29708
29709 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
29710         LDKUntrustedString ret_var = UntrustedString_clone(arg);
29711         uint64_t ret_ref = 0;
29712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29714         return ret_ref;
29715 }
29716 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
29717         LDKUntrustedString arg_conv;
29718         arg_conv.inner = untag_ptr(arg);
29719         arg_conv.is_owned = ptr_is_owned(arg);
29720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29721         arg_conv.is_owned = false;
29722         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
29723         return ret_conv;
29724 }
29725
29726 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
29727         LDKUntrustedString orig_conv;
29728         orig_conv.inner = untag_ptr(orig);
29729         orig_conv.is_owned = ptr_is_owned(orig);
29730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29731         orig_conv.is_owned = false;
29732         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
29733         uint64_t ret_ref = 0;
29734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29736         return ret_ref;
29737 }
29738
29739 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
29740         LDKUntrustedString a_conv;
29741         a_conv.inner = untag_ptr(a);
29742         a_conv.is_owned = ptr_is_owned(a);
29743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29744         a_conv.is_owned = false;
29745         LDKUntrustedString b_conv;
29746         b_conv.inner = untag_ptr(b);
29747         b_conv.is_owned = ptr_is_owned(b);
29748         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29749         b_conv.is_owned = false;
29750         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
29751         return ret_conv;
29752 }
29753
29754 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
29755         LDKUntrustedString obj_conv;
29756         obj_conv.inner = untag_ptr(obj);
29757         obj_conv.is_owned = ptr_is_owned(obj);
29758         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29759         obj_conv.is_owned = false;
29760         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
29761         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29762         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29763         CVec_u8Z_free(ret_var);
29764         return ret_arr;
29765 }
29766
29767 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
29768         LDKu8slice ser_ref;
29769         ser_ref.datalen = ser->arr_len;
29770         ser_ref.data = ser->elems;
29771         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
29772         *ret_conv = UntrustedString_read(ser_ref);
29773         FREE(ser);
29774         return tag_ptr(ret_conv, true);
29775 }
29776
29777 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
29778         LDKPrintableString this_obj_conv;
29779         this_obj_conv.inner = untag_ptr(this_obj);
29780         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29782         PrintableString_free(this_obj_conv);
29783 }
29784
29785 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
29786         LDKPrintableString this_ptr_conv;
29787         this_ptr_conv.inner = untag_ptr(this_ptr);
29788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29790         this_ptr_conv.is_owned = false;
29791         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
29792         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29793         Str_free(ret_str);
29794         return ret_conv;
29795 }
29796
29797 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
29798         LDKPrintableString this_ptr_conv;
29799         this_ptr_conv.inner = untag_ptr(this_ptr);
29800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29802         this_ptr_conv.is_owned = false;
29803         LDKStr val_conv = str_ref_to_owned_c(val);
29804         PrintableString_set_a(&this_ptr_conv, val_conv);
29805 }
29806
29807 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
29808         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
29809         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
29810         uint64_t ret_ref = 0;
29811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29813         return ret_ref;
29814 }
29815
29816 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
29817         if (!ptr_is_owned(this_ptr)) return;
29818         void* this_ptr_ptr = untag_ptr(this_ptr);
29819         CHECK_ACCESS(this_ptr_ptr);
29820         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
29821         FREE(untag_ptr(this_ptr));
29822         FutureCallback_free(this_ptr_conv);
29823 }
29824
29825 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
29826         LDKFuture this_obj_conv;
29827         this_obj_conv.inner = untag_ptr(this_obj);
29828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29830         Future_free(this_obj_conv);
29831 }
29832
29833 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
29834         LDKFuture ret_var = Future_clone(arg);
29835         uint64_t ret_ref = 0;
29836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29838         return ret_ref;
29839 }
29840 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
29841         LDKFuture arg_conv;
29842         arg_conv.inner = untag_ptr(arg);
29843         arg_conv.is_owned = ptr_is_owned(arg);
29844         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29845         arg_conv.is_owned = false;
29846         int64_t ret_conv = Future_clone_ptr(&arg_conv);
29847         return ret_conv;
29848 }
29849
29850 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
29851         LDKFuture orig_conv;
29852         orig_conv.inner = untag_ptr(orig);
29853         orig_conv.is_owned = ptr_is_owned(orig);
29854         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29855         orig_conv.is_owned = false;
29856         LDKFuture ret_var = Future_clone(&orig_conv);
29857         uint64_t ret_ref = 0;
29858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29860         return ret_ref;
29861 }
29862
29863 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
29864         LDKFuture this_arg_conv;
29865         this_arg_conv.inner = untag_ptr(this_arg);
29866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29868         this_arg_conv.is_owned = false;
29869         void* callback_ptr = untag_ptr(callback);
29870         CHECK_ACCESS(callback_ptr);
29871         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
29872         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
29873                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29874                 LDKFutureCallback_JCalls_cloned(&callback_conv);
29875         }
29876         Future_register_callback_fn(&this_arg_conv, callback_conv);
29877 }
29878
29879 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
29880         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
29881         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
29882         return ret_conv;
29883 }
29884
29885 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
29886         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
29887         return ret_conv;
29888 }
29889
29890 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
29891         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
29892         return ret_conv;
29893 }
29894
29895 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
29896         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
29897         return ret_conv;
29898 }
29899
29900 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
29901         uint32_t ret_conv = LDKLevel_to_js(Level_info());
29902         return ret_conv;
29903 }
29904
29905 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
29906         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
29907         return ret_conv;
29908 }
29909
29910 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
29911         uint32_t ret_conv = LDKLevel_to_js(Level_error());
29912         return ret_conv;
29913 }
29914
29915 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
29916         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
29917         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
29918         jboolean ret_conv = Level_eq(a_conv, b_conv);
29919         return ret_conv;
29920 }
29921
29922 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
29923         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
29924         int64_t ret_conv = Level_hash(o_conv);
29925         return ret_conv;
29926 }
29927
29928 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
29929         uint32_t ret_conv = LDKLevel_to_js(Level_max());
29930         return ret_conv;
29931 }
29932
29933 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
29934         LDKRecord this_obj_conv;
29935         this_obj_conv.inner = untag_ptr(this_obj);
29936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29938         Record_free(this_obj_conv);
29939 }
29940
29941 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
29942         LDKRecord this_ptr_conv;
29943         this_ptr_conv.inner = untag_ptr(this_ptr);
29944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29946         this_ptr_conv.is_owned = false;
29947         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
29948         return ret_conv;
29949 }
29950
29951 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
29952         LDKRecord this_ptr_conv;
29953         this_ptr_conv.inner = untag_ptr(this_ptr);
29954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29956         this_ptr_conv.is_owned = false;
29957         LDKLevel val_conv = LDKLevel_from_js(val);
29958         Record_set_level(&this_ptr_conv, val_conv);
29959 }
29960
29961 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
29962         LDKRecord this_ptr_conv;
29963         this_ptr_conv.inner = untag_ptr(this_ptr);
29964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29966         this_ptr_conv.is_owned = false;
29967         LDKStr ret_str = Record_get_args(&this_ptr_conv);
29968         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29969         Str_free(ret_str);
29970         return ret_conv;
29971 }
29972
29973 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
29974         LDKRecord this_ptr_conv;
29975         this_ptr_conv.inner = untag_ptr(this_ptr);
29976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29978         this_ptr_conv.is_owned = false;
29979         LDKStr val_conv = str_ref_to_owned_c(val);
29980         Record_set_args(&this_ptr_conv, val_conv);
29981 }
29982
29983 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
29984         LDKRecord this_ptr_conv;
29985         this_ptr_conv.inner = untag_ptr(this_ptr);
29986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29988         this_ptr_conv.is_owned = false;
29989         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
29990         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29991         Str_free(ret_str);
29992         return ret_conv;
29993 }
29994
29995 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
29996         LDKRecord this_ptr_conv;
29997         this_ptr_conv.inner = untag_ptr(this_ptr);
29998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30000         this_ptr_conv.is_owned = false;
30001         LDKStr val_conv = str_ref_to_owned_c(val);
30002         Record_set_module_path(&this_ptr_conv, val_conv);
30003 }
30004
30005 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
30006         LDKRecord this_ptr_conv;
30007         this_ptr_conv.inner = untag_ptr(this_ptr);
30008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30010         this_ptr_conv.is_owned = false;
30011         LDKStr ret_str = Record_get_file(&this_ptr_conv);
30012         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30013         Str_free(ret_str);
30014         return ret_conv;
30015 }
30016
30017 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
30018         LDKRecord this_ptr_conv;
30019         this_ptr_conv.inner = untag_ptr(this_ptr);
30020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30022         this_ptr_conv.is_owned = false;
30023         LDKStr val_conv = str_ref_to_owned_c(val);
30024         Record_set_file(&this_ptr_conv, val_conv);
30025 }
30026
30027 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
30028         LDKRecord this_ptr_conv;
30029         this_ptr_conv.inner = untag_ptr(this_ptr);
30030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30032         this_ptr_conv.is_owned = false;
30033         int32_t ret_conv = Record_get_line(&this_ptr_conv);
30034         return ret_conv;
30035 }
30036
30037 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
30038         LDKRecord this_ptr_conv;
30039         this_ptr_conv.inner = untag_ptr(this_ptr);
30040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30042         this_ptr_conv.is_owned = false;
30043         Record_set_line(&this_ptr_conv, val);
30044 }
30045
30046 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
30047         LDKRecord ret_var = Record_clone(arg);
30048         uint64_t ret_ref = 0;
30049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30051         return ret_ref;
30052 }
30053 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
30054         LDKRecord arg_conv;
30055         arg_conv.inner = untag_ptr(arg);
30056         arg_conv.is_owned = ptr_is_owned(arg);
30057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30058         arg_conv.is_owned = false;
30059         int64_t ret_conv = Record_clone_ptr(&arg_conv);
30060         return ret_conv;
30061 }
30062
30063 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
30064         LDKRecord orig_conv;
30065         orig_conv.inner = untag_ptr(orig);
30066         orig_conv.is_owned = ptr_is_owned(orig);
30067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30068         orig_conv.is_owned = false;
30069         LDKRecord ret_var = Record_clone(&orig_conv);
30070         uint64_t ret_ref = 0;
30071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30073         return ret_ref;
30074 }
30075
30076 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
30077         if (!ptr_is_owned(this_ptr)) return;
30078         void* this_ptr_ptr = untag_ptr(this_ptr);
30079         CHECK_ACCESS(this_ptr_ptr);
30080         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
30081         FREE(untag_ptr(this_ptr));
30082         Logger_free(this_ptr_conv);
30083 }
30084
30085 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
30086         LDKChannelHandshakeConfig this_obj_conv;
30087         this_obj_conv.inner = untag_ptr(this_obj);
30088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30090         ChannelHandshakeConfig_free(this_obj_conv);
30091 }
30092
30093 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
30094         LDKChannelHandshakeConfig this_ptr_conv;
30095         this_ptr_conv.inner = untag_ptr(this_ptr);
30096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30098         this_ptr_conv.is_owned = false;
30099         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
30100         return ret_conv;
30101 }
30102
30103 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
30104         LDKChannelHandshakeConfig this_ptr_conv;
30105         this_ptr_conv.inner = untag_ptr(this_ptr);
30106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30108         this_ptr_conv.is_owned = false;
30109         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
30110 }
30111
30112 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
30113         LDKChannelHandshakeConfig this_ptr_conv;
30114         this_ptr_conv.inner = untag_ptr(this_ptr);
30115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30117         this_ptr_conv.is_owned = false;
30118         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
30119         return ret_conv;
30120 }
30121
30122 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) {
30123         LDKChannelHandshakeConfig this_ptr_conv;
30124         this_ptr_conv.inner = untag_ptr(this_ptr);
30125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30127         this_ptr_conv.is_owned = false;
30128         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
30129 }
30130
30131 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
30132         LDKChannelHandshakeConfig this_ptr_conv;
30133         this_ptr_conv.inner = untag_ptr(this_ptr);
30134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30136         this_ptr_conv.is_owned = false;
30137         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
30138         return ret_conv;
30139 }
30140
30141 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) {
30142         LDKChannelHandshakeConfig this_ptr_conv;
30143         this_ptr_conv.inner = untag_ptr(this_ptr);
30144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30146         this_ptr_conv.is_owned = false;
30147         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
30148 }
30149
30150 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) {
30151         LDKChannelHandshakeConfig this_ptr_conv;
30152         this_ptr_conv.inner = untag_ptr(this_ptr);
30153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30155         this_ptr_conv.is_owned = false;
30156         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
30157         return ret_conv;
30158 }
30159
30160 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) {
30161         LDKChannelHandshakeConfig this_ptr_conv;
30162         this_ptr_conv.inner = untag_ptr(this_ptr);
30163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30165         this_ptr_conv.is_owned = false;
30166         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
30167 }
30168
30169 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
30170         LDKChannelHandshakeConfig this_ptr_conv;
30171         this_ptr_conv.inner = untag_ptr(this_ptr);
30172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30174         this_ptr_conv.is_owned = false;
30175         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
30176         return ret_conv;
30177 }
30178
30179 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
30180         LDKChannelHandshakeConfig this_ptr_conv;
30181         this_ptr_conv.inner = untag_ptr(this_ptr);
30182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30184         this_ptr_conv.is_owned = false;
30185         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
30186 }
30187
30188 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
30189         LDKChannelHandshakeConfig this_ptr_conv;
30190         this_ptr_conv.inner = untag_ptr(this_ptr);
30191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30193         this_ptr_conv.is_owned = false;
30194         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
30195         return ret_conv;
30196 }
30197
30198 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
30199         LDKChannelHandshakeConfig this_ptr_conv;
30200         this_ptr_conv.inner = untag_ptr(this_ptr);
30201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30203         this_ptr_conv.is_owned = false;
30204         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
30205 }
30206
30207 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
30208         LDKChannelHandshakeConfig this_ptr_conv;
30209         this_ptr_conv.inner = untag_ptr(this_ptr);
30210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30212         this_ptr_conv.is_owned = false;
30213         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
30214         return ret_conv;
30215 }
30216
30217 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
30218         LDKChannelHandshakeConfig this_ptr_conv;
30219         this_ptr_conv.inner = untag_ptr(this_ptr);
30220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30222         this_ptr_conv.is_owned = false;
30223         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
30224 }
30225
30226 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) {
30227         LDKChannelHandshakeConfig this_ptr_conv;
30228         this_ptr_conv.inner = untag_ptr(this_ptr);
30229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30231         this_ptr_conv.is_owned = false;
30232         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
30233         return ret_conv;
30234 }
30235
30236 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) {
30237         LDKChannelHandshakeConfig this_ptr_conv;
30238         this_ptr_conv.inner = untag_ptr(this_ptr);
30239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30241         this_ptr_conv.is_owned = false;
30242         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
30243 }
30244
30245 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) {
30246         LDKChannelHandshakeConfig this_ptr_conv;
30247         this_ptr_conv.inner = untag_ptr(this_ptr);
30248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30250         this_ptr_conv.is_owned = false;
30251         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
30252         return ret_conv;
30253 }
30254
30255 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) {
30256         LDKChannelHandshakeConfig this_ptr_conv;
30257         this_ptr_conv.inner = untag_ptr(this_ptr);
30258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30260         this_ptr_conv.is_owned = false;
30261         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
30262 }
30263
30264 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
30265         LDKChannelHandshakeConfig this_ptr_conv;
30266         this_ptr_conv.inner = untag_ptr(this_ptr);
30267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30269         this_ptr_conv.is_owned = false;
30270         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
30271         return ret_conv;
30272 }
30273
30274 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) {
30275         LDKChannelHandshakeConfig this_ptr_conv;
30276         this_ptr_conv.inner = untag_ptr(this_ptr);
30277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30279         this_ptr_conv.is_owned = false;
30280         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
30281 }
30282
30283 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) {
30284         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);
30285         uint64_t ret_ref = 0;
30286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30288         return ret_ref;
30289 }
30290
30291 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
30292         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
30293         uint64_t ret_ref = 0;
30294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30296         return ret_ref;
30297 }
30298 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
30299         LDKChannelHandshakeConfig arg_conv;
30300         arg_conv.inner = untag_ptr(arg);
30301         arg_conv.is_owned = ptr_is_owned(arg);
30302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30303         arg_conv.is_owned = false;
30304         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
30305         return ret_conv;
30306 }
30307
30308 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
30309         LDKChannelHandshakeConfig orig_conv;
30310         orig_conv.inner = untag_ptr(orig);
30311         orig_conv.is_owned = ptr_is_owned(orig);
30312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30313         orig_conv.is_owned = false;
30314         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
30315         uint64_t ret_ref = 0;
30316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30318         return ret_ref;
30319 }
30320
30321 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
30322         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
30323         uint64_t ret_ref = 0;
30324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30326         return ret_ref;
30327 }
30328
30329 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
30330         LDKChannelHandshakeLimits this_obj_conv;
30331         this_obj_conv.inner = untag_ptr(this_obj);
30332         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30334         ChannelHandshakeLimits_free(this_obj_conv);
30335 }
30336
30337 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
30338         LDKChannelHandshakeLimits this_ptr_conv;
30339         this_ptr_conv.inner = untag_ptr(this_ptr);
30340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30342         this_ptr_conv.is_owned = false;
30343         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
30344         return ret_conv;
30345 }
30346
30347 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
30348         LDKChannelHandshakeLimits this_ptr_conv;
30349         this_ptr_conv.inner = untag_ptr(this_ptr);
30350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30352         this_ptr_conv.is_owned = false;
30353         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
30354 }
30355
30356 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
30357         LDKChannelHandshakeLimits this_ptr_conv;
30358         this_ptr_conv.inner = untag_ptr(this_ptr);
30359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30361         this_ptr_conv.is_owned = false;
30362         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
30363         return ret_conv;
30364 }
30365
30366 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
30367         LDKChannelHandshakeLimits this_ptr_conv;
30368         this_ptr_conv.inner = untag_ptr(this_ptr);
30369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30371         this_ptr_conv.is_owned = false;
30372         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
30373 }
30374
30375 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
30376         LDKChannelHandshakeLimits this_ptr_conv;
30377         this_ptr_conv.inner = untag_ptr(this_ptr);
30378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30380         this_ptr_conv.is_owned = false;
30381         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
30382         return ret_conv;
30383 }
30384
30385 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) {
30386         LDKChannelHandshakeLimits this_ptr_conv;
30387         this_ptr_conv.inner = untag_ptr(this_ptr);
30388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30390         this_ptr_conv.is_owned = false;
30391         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
30392 }
30393
30394 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) {
30395         LDKChannelHandshakeLimits this_ptr_conv;
30396         this_ptr_conv.inner = untag_ptr(this_ptr);
30397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30399         this_ptr_conv.is_owned = false;
30400         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
30401         return ret_conv;
30402 }
30403
30404 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) {
30405         LDKChannelHandshakeLimits this_ptr_conv;
30406         this_ptr_conv.inner = untag_ptr(this_ptr);
30407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30409         this_ptr_conv.is_owned = false;
30410         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30411 }
30412
30413 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
30414         LDKChannelHandshakeLimits this_ptr_conv;
30415         this_ptr_conv.inner = untag_ptr(this_ptr);
30416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30418         this_ptr_conv.is_owned = false;
30419         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
30420         return ret_conv;
30421 }
30422
30423 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) {
30424         LDKChannelHandshakeLimits this_ptr_conv;
30425         this_ptr_conv.inner = untag_ptr(this_ptr);
30426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30428         this_ptr_conv.is_owned = false;
30429         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
30430 }
30431
30432 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
30433         LDKChannelHandshakeLimits this_ptr_conv;
30434         this_ptr_conv.inner = untag_ptr(this_ptr);
30435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30437         this_ptr_conv.is_owned = false;
30438         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
30439         return ret_conv;
30440 }
30441
30442 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) {
30443         LDKChannelHandshakeLimits this_ptr_conv;
30444         this_ptr_conv.inner = untag_ptr(this_ptr);
30445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30447         this_ptr_conv.is_owned = false;
30448         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
30449 }
30450
30451 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
30452         LDKChannelHandshakeLimits this_ptr_conv;
30453         this_ptr_conv.inner = untag_ptr(this_ptr);
30454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30456         this_ptr_conv.is_owned = false;
30457         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
30458         return ret_conv;
30459 }
30460
30461 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
30462         LDKChannelHandshakeLimits this_ptr_conv;
30463         this_ptr_conv.inner = untag_ptr(this_ptr);
30464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30466         this_ptr_conv.is_owned = false;
30467         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
30468 }
30469
30470 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
30471         LDKChannelHandshakeLimits this_ptr_conv;
30472         this_ptr_conv.inner = untag_ptr(this_ptr);
30473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30475         this_ptr_conv.is_owned = false;
30476         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
30477         return ret_conv;
30478 }
30479
30480 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
30481         LDKChannelHandshakeLimits this_ptr_conv;
30482         this_ptr_conv.inner = untag_ptr(this_ptr);
30483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30485         this_ptr_conv.is_owned = false;
30486         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
30487 }
30488
30489 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
30490         LDKChannelHandshakeLimits this_ptr_conv;
30491         this_ptr_conv.inner = untag_ptr(this_ptr);
30492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30494         this_ptr_conv.is_owned = false;
30495         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
30496         return ret_conv;
30497 }
30498
30499 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
30500         LDKChannelHandshakeLimits this_ptr_conv;
30501         this_ptr_conv.inner = untag_ptr(this_ptr);
30502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30504         this_ptr_conv.is_owned = false;
30505         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
30506 }
30507
30508 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
30509         LDKChannelHandshakeLimits this_ptr_conv;
30510         this_ptr_conv.inner = untag_ptr(this_ptr);
30511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30513         this_ptr_conv.is_owned = false;
30514         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
30515         return ret_conv;
30516 }
30517
30518 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) {
30519         LDKChannelHandshakeLimits this_ptr_conv;
30520         this_ptr_conv.inner = untag_ptr(this_ptr);
30521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30523         this_ptr_conv.is_owned = false;
30524         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
30525 }
30526
30527 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) {
30528         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);
30529         uint64_t ret_ref = 0;
30530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30532         return ret_ref;
30533 }
30534
30535 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
30536         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
30537         uint64_t ret_ref = 0;
30538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30540         return ret_ref;
30541 }
30542 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
30543         LDKChannelHandshakeLimits arg_conv;
30544         arg_conv.inner = untag_ptr(arg);
30545         arg_conv.is_owned = ptr_is_owned(arg);
30546         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30547         arg_conv.is_owned = false;
30548         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
30549         return ret_conv;
30550 }
30551
30552 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
30553         LDKChannelHandshakeLimits orig_conv;
30554         orig_conv.inner = untag_ptr(orig);
30555         orig_conv.is_owned = ptr_is_owned(orig);
30556         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30557         orig_conv.is_owned = false;
30558         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
30559         uint64_t ret_ref = 0;
30560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30562         return ret_ref;
30563 }
30564
30565 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
30566         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
30567         uint64_t ret_ref = 0;
30568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30570         return ret_ref;
30571 }
30572
30573 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
30574         if (!ptr_is_owned(this_ptr)) return;
30575         void* this_ptr_ptr = untag_ptr(this_ptr);
30576         CHECK_ACCESS(this_ptr_ptr);
30577         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
30578         FREE(untag_ptr(this_ptr));
30579         MaxDustHTLCExposure_free(this_ptr_conv);
30580 }
30581
30582 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
30583         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30584         *ret_copy = MaxDustHTLCExposure_clone(arg);
30585         uint64_t ret_ref = tag_ptr(ret_copy, true);
30586         return ret_ref;
30587 }
30588 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
30589         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
30590         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
30591         return ret_conv;
30592 }
30593
30594 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
30595         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
30596         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30597         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
30598         uint64_t ret_ref = tag_ptr(ret_copy, true);
30599         return ret_ref;
30600 }
30601
30602 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
30603         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30604         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
30605         uint64_t ret_ref = tag_ptr(ret_copy, true);
30606         return ret_ref;
30607 }
30608
30609 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
30610         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30611         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
30612         uint64_t ret_ref = tag_ptr(ret_copy, true);
30613         return ret_ref;
30614 }
30615
30616 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
30617         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
30618         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
30619         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
30620         return ret_conv;
30621 }
30622
30623 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
30624         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
30625         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
30626         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30627         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30628         CVec_u8Z_free(ret_var);
30629         return ret_arr;
30630 }
30631
30632 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
30633         LDKu8slice ser_ref;
30634         ser_ref.datalen = ser->arr_len;
30635         ser_ref.data = ser->elems;
30636         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
30637         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
30638         FREE(ser);
30639         return tag_ptr(ret_conv, true);
30640 }
30641
30642 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
30643         LDKChannelConfig this_obj_conv;
30644         this_obj_conv.inner = untag_ptr(this_obj);
30645         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30647         ChannelConfig_free(this_obj_conv);
30648 }
30649
30650 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
30651         LDKChannelConfig this_ptr_conv;
30652         this_ptr_conv.inner = untag_ptr(this_ptr);
30653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30655         this_ptr_conv.is_owned = false;
30656         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
30657         return ret_conv;
30658 }
30659
30660 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) {
30661         LDKChannelConfig this_ptr_conv;
30662         this_ptr_conv.inner = untag_ptr(this_ptr);
30663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30665         this_ptr_conv.is_owned = false;
30666         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
30667 }
30668
30669 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
30670         LDKChannelConfig this_ptr_conv;
30671         this_ptr_conv.inner = untag_ptr(this_ptr);
30672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30674         this_ptr_conv.is_owned = false;
30675         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
30676         return ret_conv;
30677 }
30678
30679 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) {
30680         LDKChannelConfig this_ptr_conv;
30681         this_ptr_conv.inner = untag_ptr(this_ptr);
30682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30684         this_ptr_conv.is_owned = false;
30685         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
30686 }
30687
30688 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
30689         LDKChannelConfig this_ptr_conv;
30690         this_ptr_conv.inner = untag_ptr(this_ptr);
30691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30693         this_ptr_conv.is_owned = false;
30694         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
30695         return ret_conv;
30696 }
30697
30698 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
30699         LDKChannelConfig this_ptr_conv;
30700         this_ptr_conv.inner = untag_ptr(this_ptr);
30701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30703         this_ptr_conv.is_owned = false;
30704         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
30705 }
30706
30707 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
30708         LDKChannelConfig this_ptr_conv;
30709         this_ptr_conv.inner = untag_ptr(this_ptr);
30710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30712         this_ptr_conv.is_owned = false;
30713         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30714         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
30715         uint64_t ret_ref = tag_ptr(ret_copy, true);
30716         return ret_ref;
30717 }
30718
30719 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) {
30720         LDKChannelConfig this_ptr_conv;
30721         this_ptr_conv.inner = untag_ptr(this_ptr);
30722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30724         this_ptr_conv.is_owned = false;
30725         void* val_ptr = untag_ptr(val);
30726         CHECK_ACCESS(val_ptr);
30727         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
30728         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
30729         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
30730 }
30731
30732 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) {
30733         LDKChannelConfig this_ptr_conv;
30734         this_ptr_conv.inner = untag_ptr(this_ptr);
30735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30737         this_ptr_conv.is_owned = false;
30738         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
30739         return ret_conv;
30740 }
30741
30742 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) {
30743         LDKChannelConfig this_ptr_conv;
30744         this_ptr_conv.inner = untag_ptr(this_ptr);
30745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30747         this_ptr_conv.is_owned = false;
30748         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
30749 }
30750
30751 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
30752         LDKChannelConfig this_ptr_conv;
30753         this_ptr_conv.inner = untag_ptr(this_ptr);
30754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30756         this_ptr_conv.is_owned = false;
30757         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
30758         return ret_conv;
30759 }
30760
30761 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
30762         LDKChannelConfig this_ptr_conv;
30763         this_ptr_conv.inner = untag_ptr(this_ptr);
30764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30766         this_ptr_conv.is_owned = false;
30767         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
30768 }
30769
30770 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) {
30771         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
30772         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
30773         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
30774         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
30775         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);
30776         uint64_t ret_ref = 0;
30777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30779         return ret_ref;
30780 }
30781
30782 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
30783         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
30784         uint64_t ret_ref = 0;
30785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30787         return ret_ref;
30788 }
30789 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
30790         LDKChannelConfig arg_conv;
30791         arg_conv.inner = untag_ptr(arg);
30792         arg_conv.is_owned = ptr_is_owned(arg);
30793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30794         arg_conv.is_owned = false;
30795         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
30796         return ret_conv;
30797 }
30798
30799 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
30800         LDKChannelConfig orig_conv;
30801         orig_conv.inner = untag_ptr(orig);
30802         orig_conv.is_owned = ptr_is_owned(orig);
30803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30804         orig_conv.is_owned = false;
30805         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
30806         uint64_t ret_ref = 0;
30807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30809         return ret_ref;
30810 }
30811
30812 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
30813         LDKChannelConfig a_conv;
30814         a_conv.inner = untag_ptr(a);
30815         a_conv.is_owned = ptr_is_owned(a);
30816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30817         a_conv.is_owned = false;
30818         LDKChannelConfig b_conv;
30819         b_conv.inner = untag_ptr(b);
30820         b_conv.is_owned = ptr_is_owned(b);
30821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30822         b_conv.is_owned = false;
30823         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
30824         return ret_conv;
30825 }
30826
30827 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
30828         LDKChannelConfig this_arg_conv;
30829         this_arg_conv.inner = untag_ptr(this_arg);
30830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30832         this_arg_conv.is_owned = false;
30833         LDKChannelConfigUpdate update_conv;
30834         update_conv.inner = untag_ptr(update);
30835         update_conv.is_owned = ptr_is_owned(update);
30836         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
30837         update_conv.is_owned = false;
30838         ChannelConfig_apply(&this_arg_conv, &update_conv);
30839 }
30840
30841 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
30842         LDKChannelConfig ret_var = ChannelConfig_default();
30843         uint64_t ret_ref = 0;
30844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30846         return ret_ref;
30847 }
30848
30849 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
30850         LDKChannelConfig obj_conv;
30851         obj_conv.inner = untag_ptr(obj);
30852         obj_conv.is_owned = ptr_is_owned(obj);
30853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30854         obj_conv.is_owned = false;
30855         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
30856         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30857         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30858         CVec_u8Z_free(ret_var);
30859         return ret_arr;
30860 }
30861
30862 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
30863         LDKu8slice ser_ref;
30864         ser_ref.datalen = ser->arr_len;
30865         ser_ref.data = ser->elems;
30866         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
30867         *ret_conv = ChannelConfig_read(ser_ref);
30868         FREE(ser);
30869         return tag_ptr(ret_conv, true);
30870 }
30871
30872 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
30873         LDKChannelConfigUpdate this_obj_conv;
30874         this_obj_conv.inner = untag_ptr(this_obj);
30875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30877         ChannelConfigUpdate_free(this_obj_conv);
30878 }
30879
30880 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
30881         LDKChannelConfigUpdate this_ptr_conv;
30882         this_ptr_conv.inner = untag_ptr(this_ptr);
30883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30885         this_ptr_conv.is_owned = false;
30886         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
30887         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
30888         uint64_t ret_ref = tag_ptr(ret_copy, true);
30889         return ret_ref;
30890 }
30891
30892 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) {
30893         LDKChannelConfigUpdate this_ptr_conv;
30894         this_ptr_conv.inner = untag_ptr(this_ptr);
30895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30897         this_ptr_conv.is_owned = false;
30898         void* val_ptr = untag_ptr(val);
30899         CHECK_ACCESS(val_ptr);
30900         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
30901         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
30902         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
30903 }
30904
30905 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
30906         LDKChannelConfigUpdate this_ptr_conv;
30907         this_ptr_conv.inner = untag_ptr(this_ptr);
30908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30910         this_ptr_conv.is_owned = false;
30911         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
30912         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
30913         uint64_t ret_ref = tag_ptr(ret_copy, true);
30914         return ret_ref;
30915 }
30916
30917 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) {
30918         LDKChannelConfigUpdate this_ptr_conv;
30919         this_ptr_conv.inner = untag_ptr(this_ptr);
30920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30922         this_ptr_conv.is_owned = false;
30923         void* val_ptr = untag_ptr(val);
30924         CHECK_ACCESS(val_ptr);
30925         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
30926         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
30927         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
30928 }
30929
30930 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
30931         LDKChannelConfigUpdate this_ptr_conv;
30932         this_ptr_conv.inner = untag_ptr(this_ptr);
30933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30935         this_ptr_conv.is_owned = false;
30936         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
30937         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
30938         uint64_t ret_ref = tag_ptr(ret_copy, true);
30939         return ret_ref;
30940 }
30941
30942 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
30943         LDKChannelConfigUpdate this_ptr_conv;
30944         this_ptr_conv.inner = untag_ptr(this_ptr);
30945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30947         this_ptr_conv.is_owned = false;
30948         void* val_ptr = untag_ptr(val);
30949         CHECK_ACCESS(val_ptr);
30950         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
30951         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
30952         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
30953 }
30954
30955 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) {
30956         LDKChannelConfigUpdate this_ptr_conv;
30957         this_ptr_conv.inner = untag_ptr(this_ptr);
30958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30960         this_ptr_conv.is_owned = false;
30961         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
30962         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
30963         uint64_t ret_ref = tag_ptr(ret_copy, true);
30964         return ret_ref;
30965 }
30966
30967 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) {
30968         LDKChannelConfigUpdate this_ptr_conv;
30969         this_ptr_conv.inner = untag_ptr(this_ptr);
30970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30972         this_ptr_conv.is_owned = false;
30973         void* val_ptr = untag_ptr(val);
30974         CHECK_ACCESS(val_ptr);
30975         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
30976         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
30977         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
30978 }
30979
30980 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) {
30981         LDKChannelConfigUpdate this_ptr_conv;
30982         this_ptr_conv.inner = untag_ptr(this_ptr);
30983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30985         this_ptr_conv.is_owned = false;
30986         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30987         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
30988         uint64_t ret_ref = tag_ptr(ret_copy, true);
30989         return ret_ref;
30990 }
30991
30992 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) {
30993         LDKChannelConfigUpdate this_ptr_conv;
30994         this_ptr_conv.inner = untag_ptr(this_ptr);
30995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30997         this_ptr_conv.is_owned = false;
30998         void* val_ptr = untag_ptr(val);
30999         CHECK_ACCESS(val_ptr);
31000         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31001         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31002         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
31003 }
31004
31005 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) {
31006         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
31007         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
31008         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
31009         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
31010         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
31011         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
31012         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
31013         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
31014         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
31015         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
31016         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
31017         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
31018         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
31019         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
31020         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
31021         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
31022         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
31023         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
31024         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
31025         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
31026         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);
31027         uint64_t ret_ref = 0;
31028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31030         return ret_ref;
31031 }
31032
31033 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
31034         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
31035         uint64_t ret_ref = 0;
31036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31038         return ret_ref;
31039 }
31040
31041 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
31042         LDKUserConfig this_obj_conv;
31043         this_obj_conv.inner = untag_ptr(this_obj);
31044         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31046         UserConfig_free(this_obj_conv);
31047 }
31048
31049 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
31050         LDKUserConfig this_ptr_conv;
31051         this_ptr_conv.inner = untag_ptr(this_ptr);
31052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31054         this_ptr_conv.is_owned = false;
31055         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
31056         uint64_t ret_ref = 0;
31057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31059         return ret_ref;
31060 }
31061
31062 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
31063         LDKUserConfig this_ptr_conv;
31064         this_ptr_conv.inner = untag_ptr(this_ptr);
31065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31067         this_ptr_conv.is_owned = false;
31068         LDKChannelHandshakeConfig val_conv;
31069         val_conv.inner = untag_ptr(val);
31070         val_conv.is_owned = ptr_is_owned(val);
31071         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31072         val_conv = ChannelHandshakeConfig_clone(&val_conv);
31073         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
31074 }
31075
31076 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
31077         LDKUserConfig this_ptr_conv;
31078         this_ptr_conv.inner = untag_ptr(this_ptr);
31079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31081         this_ptr_conv.is_owned = false;
31082         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
31083         uint64_t ret_ref = 0;
31084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31086         return ret_ref;
31087 }
31088
31089 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
31090         LDKUserConfig this_ptr_conv;
31091         this_ptr_conv.inner = untag_ptr(this_ptr);
31092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31094         this_ptr_conv.is_owned = false;
31095         LDKChannelHandshakeLimits val_conv;
31096         val_conv.inner = untag_ptr(val);
31097         val_conv.is_owned = ptr_is_owned(val);
31098         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31099         val_conv = ChannelHandshakeLimits_clone(&val_conv);
31100         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
31101 }
31102
31103 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
31104         LDKUserConfig this_ptr_conv;
31105         this_ptr_conv.inner = untag_ptr(this_ptr);
31106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31108         this_ptr_conv.is_owned = false;
31109         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
31110         uint64_t ret_ref = 0;
31111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31113         return ret_ref;
31114 }
31115
31116 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
31117         LDKUserConfig this_ptr_conv;
31118         this_ptr_conv.inner = untag_ptr(this_ptr);
31119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31121         this_ptr_conv.is_owned = false;
31122         LDKChannelConfig val_conv;
31123         val_conv.inner = untag_ptr(val);
31124         val_conv.is_owned = ptr_is_owned(val);
31125         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31126         val_conv = ChannelConfig_clone(&val_conv);
31127         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
31128 }
31129
31130 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
31131         LDKUserConfig this_ptr_conv;
31132         this_ptr_conv.inner = untag_ptr(this_ptr);
31133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31135         this_ptr_conv.is_owned = false;
31136         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
31137         return ret_conv;
31138 }
31139
31140 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) {
31141         LDKUserConfig this_ptr_conv;
31142         this_ptr_conv.inner = untag_ptr(this_ptr);
31143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31145         this_ptr_conv.is_owned = false;
31146         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
31147 }
31148
31149 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
31150         LDKUserConfig this_ptr_conv;
31151         this_ptr_conv.inner = untag_ptr(this_ptr);
31152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31154         this_ptr_conv.is_owned = false;
31155         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
31156         return ret_conv;
31157 }
31158
31159 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
31160         LDKUserConfig this_ptr_conv;
31161         this_ptr_conv.inner = untag_ptr(this_ptr);
31162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31164         this_ptr_conv.is_owned = false;
31165         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
31166 }
31167
31168 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
31169         LDKUserConfig this_ptr_conv;
31170         this_ptr_conv.inner = untag_ptr(this_ptr);
31171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31173         this_ptr_conv.is_owned = false;
31174         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
31175         return ret_conv;
31176 }
31177
31178 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
31179         LDKUserConfig this_ptr_conv;
31180         this_ptr_conv.inner = untag_ptr(this_ptr);
31181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31183         this_ptr_conv.is_owned = false;
31184         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
31185 }
31186
31187 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
31188         LDKUserConfig this_ptr_conv;
31189         this_ptr_conv.inner = untag_ptr(this_ptr);
31190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31192         this_ptr_conv.is_owned = false;
31193         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
31194         return ret_conv;
31195 }
31196
31197 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
31198         LDKUserConfig this_ptr_conv;
31199         this_ptr_conv.inner = untag_ptr(this_ptr);
31200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31202         this_ptr_conv.is_owned = false;
31203         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
31204 }
31205
31206 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
31207         LDKUserConfig this_ptr_conv;
31208         this_ptr_conv.inner = untag_ptr(this_ptr);
31209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31211         this_ptr_conv.is_owned = false;
31212         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
31213         return ret_conv;
31214 }
31215
31216 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
31217         LDKUserConfig this_ptr_conv;
31218         this_ptr_conv.inner = untag_ptr(this_ptr);
31219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31221         this_ptr_conv.is_owned = false;
31222         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
31223 }
31224
31225 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) {
31226         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
31227         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
31228         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
31229         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
31230         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
31231         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
31232         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
31233         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
31234         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
31235         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
31236         LDKChannelConfig channel_config_arg_conv;
31237         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
31238         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
31239         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
31240         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
31241         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);
31242         uint64_t ret_ref = 0;
31243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31245         return ret_ref;
31246 }
31247
31248 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
31249         LDKUserConfig ret_var = UserConfig_clone(arg);
31250         uint64_t ret_ref = 0;
31251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31253         return ret_ref;
31254 }
31255 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
31256         LDKUserConfig arg_conv;
31257         arg_conv.inner = untag_ptr(arg);
31258         arg_conv.is_owned = ptr_is_owned(arg);
31259         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31260         arg_conv.is_owned = false;
31261         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
31262         return ret_conv;
31263 }
31264
31265 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
31266         LDKUserConfig orig_conv;
31267         orig_conv.inner = untag_ptr(orig);
31268         orig_conv.is_owned = ptr_is_owned(orig);
31269         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31270         orig_conv.is_owned = false;
31271         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
31272         uint64_t ret_ref = 0;
31273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31275         return ret_ref;
31276 }
31277
31278 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
31279         LDKUserConfig ret_var = UserConfig_default();
31280         uint64_t ret_ref = 0;
31281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31283         return ret_ref;
31284 }
31285
31286 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
31287         LDKBestBlock this_obj_conv;
31288         this_obj_conv.inner = untag_ptr(this_obj);
31289         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31291         BestBlock_free(this_obj_conv);
31292 }
31293
31294 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
31295         LDKBestBlock ret_var = BestBlock_clone(arg);
31296         uint64_t ret_ref = 0;
31297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31299         return ret_ref;
31300 }
31301 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
31302         LDKBestBlock arg_conv;
31303         arg_conv.inner = untag_ptr(arg);
31304         arg_conv.is_owned = ptr_is_owned(arg);
31305         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31306         arg_conv.is_owned = false;
31307         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
31308         return ret_conv;
31309 }
31310
31311 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
31312         LDKBestBlock orig_conv;
31313         orig_conv.inner = untag_ptr(orig);
31314         orig_conv.is_owned = ptr_is_owned(orig);
31315         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31316         orig_conv.is_owned = false;
31317         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
31318         uint64_t ret_ref = 0;
31319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31321         return ret_ref;
31322 }
31323
31324 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
31325         LDKBestBlock a_conv;
31326         a_conv.inner = untag_ptr(a);
31327         a_conv.is_owned = ptr_is_owned(a);
31328         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31329         a_conv.is_owned = false;
31330         LDKBestBlock b_conv;
31331         b_conv.inner = untag_ptr(b);
31332         b_conv.is_owned = ptr_is_owned(b);
31333         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31334         b_conv.is_owned = false;
31335         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
31336         return ret_conv;
31337 }
31338
31339 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
31340         LDKNetwork network_conv = LDKNetwork_from_js(network);
31341         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
31342         uint64_t ret_ref = 0;
31343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31345         return ret_ref;
31346 }
31347
31348 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
31349         LDKThirtyTwoBytes block_hash_ref;
31350         CHECK(block_hash->arr_len == 32);
31351         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
31352         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
31353         uint64_t ret_ref = 0;
31354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31356         return ret_ref;
31357 }
31358
31359 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
31360         LDKBestBlock this_arg_conv;
31361         this_arg_conv.inner = untag_ptr(this_arg);
31362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31364         this_arg_conv.is_owned = false;
31365         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31366         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
31367         return ret_arr;
31368 }
31369
31370 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
31371         LDKBestBlock this_arg_conv;
31372         this_arg_conv.inner = untag_ptr(this_arg);
31373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31375         this_arg_conv.is_owned = false;
31376         int32_t ret_conv = BestBlock_height(&this_arg_conv);
31377         return ret_conv;
31378 }
31379
31380 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
31381         if (!ptr_is_owned(this_ptr)) return;
31382         void* this_ptr_ptr = untag_ptr(this_ptr);
31383         CHECK_ACCESS(this_ptr_ptr);
31384         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
31385         FREE(untag_ptr(this_ptr));
31386         Listen_free(this_ptr_conv);
31387 }
31388
31389 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
31390         if (!ptr_is_owned(this_ptr)) return;
31391         void* this_ptr_ptr = untag_ptr(this_ptr);
31392         CHECK_ACCESS(this_ptr_ptr);
31393         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
31394         FREE(untag_ptr(this_ptr));
31395         Confirm_free(this_ptr_conv);
31396 }
31397
31398 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
31399         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
31400         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
31401         return ret_conv;
31402 }
31403
31404 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
31405         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
31406         return ret_conv;
31407 }
31408
31409 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
31410         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
31411         return ret_conv;
31412 }
31413
31414 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
31415         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
31416         return ret_conv;
31417 }
31418
31419 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
31420         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
31421         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
31422         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
31423         return ret_conv;
31424 }
31425
31426 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
31427         if (!ptr_is_owned(this_ptr)) return;
31428         void* this_ptr_ptr = untag_ptr(this_ptr);
31429         CHECK_ACCESS(this_ptr_ptr);
31430         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
31431         FREE(untag_ptr(this_ptr));
31432         Watch_free(this_ptr_conv);
31433 }
31434
31435 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
31436         if (!ptr_is_owned(this_ptr)) return;
31437         void* this_ptr_ptr = untag_ptr(this_ptr);
31438         CHECK_ACCESS(this_ptr_ptr);
31439         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
31440         FREE(untag_ptr(this_ptr));
31441         Filter_free(this_ptr_conv);
31442 }
31443
31444 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
31445         LDKWatchedOutput this_obj_conv;
31446         this_obj_conv.inner = untag_ptr(this_obj);
31447         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31449         WatchedOutput_free(this_obj_conv);
31450 }
31451
31452 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
31453         LDKWatchedOutput this_ptr_conv;
31454         this_ptr_conv.inner = untag_ptr(this_ptr);
31455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31457         this_ptr_conv.is_owned = false;
31458         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
31459         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
31460         uint64_t ret_ref = tag_ptr(ret_copy, true);
31461         return ret_ref;
31462 }
31463
31464 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
31465         LDKWatchedOutput this_ptr_conv;
31466         this_ptr_conv.inner = untag_ptr(this_ptr);
31467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31469         this_ptr_conv.is_owned = false;
31470         void* val_ptr = untag_ptr(val);
31471         CHECK_ACCESS(val_ptr);
31472         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
31473         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
31474         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
31475 }
31476
31477 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
31478         LDKWatchedOutput this_ptr_conv;
31479         this_ptr_conv.inner = untag_ptr(this_ptr);
31480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31482         this_ptr_conv.is_owned = false;
31483         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
31484         uint64_t ret_ref = 0;
31485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31487         return ret_ref;
31488 }
31489
31490 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
31491         LDKWatchedOutput this_ptr_conv;
31492         this_ptr_conv.inner = untag_ptr(this_ptr);
31493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31495         this_ptr_conv.is_owned = false;
31496         LDKOutPoint val_conv;
31497         val_conv.inner = untag_ptr(val);
31498         val_conv.is_owned = ptr_is_owned(val);
31499         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31500         val_conv = OutPoint_clone(&val_conv);
31501         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
31502 }
31503
31504 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
31505         LDKWatchedOutput this_ptr_conv;
31506         this_ptr_conv.inner = untag_ptr(this_ptr);
31507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31509         this_ptr_conv.is_owned = false;
31510         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
31511         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31512         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31513         return ret_arr;
31514 }
31515
31516 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
31517         LDKWatchedOutput this_ptr_conv;
31518         this_ptr_conv.inner = untag_ptr(this_ptr);
31519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31521         this_ptr_conv.is_owned = false;
31522         LDKCVec_u8Z val_ref;
31523         val_ref.datalen = val->arr_len;
31524         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31525         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
31526         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
31527 }
31528
31529 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) {
31530         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
31531         CHECK_ACCESS(block_hash_arg_ptr);
31532         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
31533         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
31534         LDKOutPoint outpoint_arg_conv;
31535         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
31536         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
31537         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
31538         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
31539         LDKCVec_u8Z script_pubkey_arg_ref;
31540         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
31541         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31542         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
31543         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
31544         uint64_t ret_ref = 0;
31545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31547         return ret_ref;
31548 }
31549
31550 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
31551         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
31552         uint64_t ret_ref = 0;
31553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31555         return ret_ref;
31556 }
31557 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
31558         LDKWatchedOutput arg_conv;
31559         arg_conv.inner = untag_ptr(arg);
31560         arg_conv.is_owned = ptr_is_owned(arg);
31561         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31562         arg_conv.is_owned = false;
31563         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
31564         return ret_conv;
31565 }
31566
31567 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
31568         LDKWatchedOutput orig_conv;
31569         orig_conv.inner = untag_ptr(orig);
31570         orig_conv.is_owned = ptr_is_owned(orig);
31571         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31572         orig_conv.is_owned = false;
31573         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
31574         uint64_t ret_ref = 0;
31575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31577         return ret_ref;
31578 }
31579
31580 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
31581         LDKWatchedOutput a_conv;
31582         a_conv.inner = untag_ptr(a);
31583         a_conv.is_owned = ptr_is_owned(a);
31584         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31585         a_conv.is_owned = false;
31586         LDKWatchedOutput b_conv;
31587         b_conv.inner = untag_ptr(b);
31588         b_conv.is_owned = ptr_is_owned(b);
31589         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31590         b_conv.is_owned = false;
31591         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
31592         return ret_conv;
31593 }
31594
31595 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
31596         LDKWatchedOutput o_conv;
31597         o_conv.inner = untag_ptr(o);
31598         o_conv.is_owned = ptr_is_owned(o);
31599         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31600         o_conv.is_owned = false;
31601         int64_t ret_conv = WatchedOutput_hash(&o_conv);
31602         return ret_conv;
31603 }
31604
31605 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
31606         if (!ptr_is_owned(this_ptr)) return;
31607         void* this_ptr_ptr = untag_ptr(this_ptr);
31608         CHECK_ACCESS(this_ptr_ptr);
31609         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
31610         FREE(untag_ptr(this_ptr));
31611         BroadcasterInterface_free(this_ptr_conv);
31612 }
31613
31614 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
31615         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
31616         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
31617         return ret_conv;
31618 }
31619
31620 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_mempool_minimum"))) TS_ConfirmationTarget_mempool_minimum() {
31621         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_mempool_minimum());
31622         return ret_conv;
31623 }
31624
31625 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
31626         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
31627         return ret_conv;
31628 }
31629
31630 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
31631         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
31632         return ret_conv;
31633 }
31634
31635 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
31636         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
31637         return ret_conv;
31638 }
31639
31640 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
31641         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
31642         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
31643         return ret_conv;
31644 }
31645
31646 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
31647         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
31648         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
31649         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
31650         return ret_conv;
31651 }
31652
31653 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
31654         if (!ptr_is_owned(this_ptr)) return;
31655         void* this_ptr_ptr = untag_ptr(this_ptr);
31656         CHECK_ACCESS(this_ptr_ptr);
31657         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
31658         FREE(untag_ptr(this_ptr));
31659         FeeEstimator_free(this_ptr_conv);
31660 }
31661
31662 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
31663         LDKMonitorUpdateId this_obj_conv;
31664         this_obj_conv.inner = untag_ptr(this_obj);
31665         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31667         MonitorUpdateId_free(this_obj_conv);
31668 }
31669
31670 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
31671         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
31672         uint64_t ret_ref = 0;
31673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31675         return ret_ref;
31676 }
31677 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
31678         LDKMonitorUpdateId arg_conv;
31679         arg_conv.inner = untag_ptr(arg);
31680         arg_conv.is_owned = ptr_is_owned(arg);
31681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31682         arg_conv.is_owned = false;
31683         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
31684         return ret_conv;
31685 }
31686
31687 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
31688         LDKMonitorUpdateId orig_conv;
31689         orig_conv.inner = untag_ptr(orig);
31690         orig_conv.is_owned = ptr_is_owned(orig);
31691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31692         orig_conv.is_owned = false;
31693         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
31694         uint64_t ret_ref = 0;
31695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31697         return ret_ref;
31698 }
31699
31700 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
31701         LDKMonitorUpdateId o_conv;
31702         o_conv.inner = untag_ptr(o);
31703         o_conv.is_owned = ptr_is_owned(o);
31704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31705         o_conv.is_owned = false;
31706         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
31707         return ret_conv;
31708 }
31709
31710 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
31711         LDKMonitorUpdateId a_conv;
31712         a_conv.inner = untag_ptr(a);
31713         a_conv.is_owned = ptr_is_owned(a);
31714         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31715         a_conv.is_owned = false;
31716         LDKMonitorUpdateId b_conv;
31717         b_conv.inner = untag_ptr(b);
31718         b_conv.is_owned = ptr_is_owned(b);
31719         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31720         b_conv.is_owned = false;
31721         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
31722         return ret_conv;
31723 }
31724
31725 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
31726         if (!ptr_is_owned(this_ptr)) return;
31727         void* this_ptr_ptr = untag_ptr(this_ptr);
31728         CHECK_ACCESS(this_ptr_ptr);
31729         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
31730         FREE(untag_ptr(this_ptr));
31731         Persist_free(this_ptr_conv);
31732 }
31733
31734 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
31735         LDKLockedChannelMonitor this_obj_conv;
31736         this_obj_conv.inner = untag_ptr(this_obj);
31737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31739         LockedChannelMonitor_free(this_obj_conv);
31740 }
31741
31742 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
31743         LDKChainMonitor this_obj_conv;
31744         this_obj_conv.inner = untag_ptr(this_obj);
31745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31747         ChainMonitor_free(this_obj_conv);
31748 }
31749
31750 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) {
31751         void* chain_source_ptr = untag_ptr(chain_source);
31752         CHECK_ACCESS(chain_source_ptr);
31753         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
31754         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
31755         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
31756                 // Manually implement clone for Java trait instances
31757                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
31758                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31759                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
31760                 }
31761         }
31762         void* broadcaster_ptr = untag_ptr(broadcaster);
31763         CHECK_ACCESS(broadcaster_ptr);
31764         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
31765         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
31766                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31767                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
31768         }
31769         void* logger_ptr = untag_ptr(logger);
31770         CHECK_ACCESS(logger_ptr);
31771         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31772         if (logger_conv.free == LDKLogger_JCalls_free) {
31773                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31774                 LDKLogger_JCalls_cloned(&logger_conv);
31775         }
31776         void* feeest_ptr = untag_ptr(feeest);
31777         CHECK_ACCESS(feeest_ptr);
31778         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
31779         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
31780                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31781                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
31782         }
31783         void* persister_ptr = untag_ptr(persister);
31784         CHECK_ACCESS(persister_ptr);
31785         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
31786         if (persister_conv.free == LDKPersist_JCalls_free) {
31787                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31788                 LDKPersist_JCalls_cloned(&persister_conv);
31789         }
31790         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
31791         uint64_t ret_ref = 0;
31792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31794         return ret_ref;
31795 }
31796
31797 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
31798         LDKChainMonitor this_arg_conv;
31799         this_arg_conv.inner = untag_ptr(this_arg);
31800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31802         this_arg_conv.is_owned = false;
31803         LDKCVec_ChannelDetailsZ ignored_channels_constr;
31804         ignored_channels_constr.datalen = ignored_channels->arr_len;
31805         if (ignored_channels_constr.datalen > 0)
31806                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
31807         else
31808                 ignored_channels_constr.data = NULL;
31809         uint64_t* ignored_channels_vals = ignored_channels->elems;
31810         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
31811                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
31812                 LDKChannelDetails ignored_channels_conv_16_conv;
31813                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
31814                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
31815                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
31816                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
31817                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
31818         }
31819         FREE(ignored_channels);
31820         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
31821         uint64_tArray ret_arr = NULL;
31822         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31823         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31824         for (size_t j = 0; j < ret_var.datalen; j++) {
31825                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
31826                 *ret_conv_9_copy = ret_var.data[j];
31827                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
31828                 ret_arr_ptr[j] = ret_conv_9_ref;
31829         }
31830         
31831         FREE(ret_var.data);
31832         return ret_arr;
31833 }
31834
31835 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
31836         LDKChainMonitor this_arg_conv;
31837         this_arg_conv.inner = untag_ptr(this_arg);
31838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31840         this_arg_conv.is_owned = false;
31841         LDKOutPoint funding_txo_conv;
31842         funding_txo_conv.inner = untag_ptr(funding_txo);
31843         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
31844         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
31845         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
31846         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31847         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
31848         return tag_ptr(ret_conv, true);
31849 }
31850
31851 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
31852         LDKChainMonitor this_arg_conv;
31853         this_arg_conv.inner = untag_ptr(this_arg);
31854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31856         this_arg_conv.is_owned = false;
31857         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
31858         uint64_tArray ret_arr = NULL;
31859         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31860         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31861         for (size_t k = 0; k < ret_var.datalen; k++) {
31862                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
31863                 uint64_t ret_conv_10_ref = 0;
31864                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
31865                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
31866                 ret_arr_ptr[k] = ret_conv_10_ref;
31867         }
31868         
31869         FREE(ret_var.data);
31870         return ret_arr;
31871 }
31872
31873 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
31874         LDKChainMonitor this_arg_conv;
31875         this_arg_conv.inner = untag_ptr(this_arg);
31876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31878         this_arg_conv.is_owned = false;
31879         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
31880         uint64_tArray ret_arr = NULL;
31881         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31882         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31883         for (size_t p = 0; p < ret_var.datalen; p++) {
31884                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31885                 *ret_conv_41_conv = ret_var.data[p];
31886                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
31887         }
31888         
31889         FREE(ret_var.data);
31890         return ret_arr;
31891 }
31892
31893 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) {
31894         LDKChainMonitor this_arg_conv;
31895         this_arg_conv.inner = untag_ptr(this_arg);
31896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31898         this_arg_conv.is_owned = false;
31899         LDKOutPoint funding_txo_conv;
31900         funding_txo_conv.inner = untag_ptr(funding_txo);
31901         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
31902         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
31903         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
31904         LDKMonitorUpdateId completed_update_id_conv;
31905         completed_update_id_conv.inner = untag_ptr(completed_update_id);
31906         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
31907         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
31908         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
31909         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31910         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
31911         return tag_ptr(ret_conv, true);
31912 }
31913
31914 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
31915         LDKChainMonitor this_arg_conv;
31916         this_arg_conv.inner = untag_ptr(this_arg);
31917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31919         this_arg_conv.is_owned = false;
31920         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
31921         uint64_t ret_ref = 0;
31922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31924         return ret_ref;
31925 }
31926
31927 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
31928         LDKChainMonitor this_arg_conv;
31929         this_arg_conv.inner = untag_ptr(this_arg);
31930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31932         this_arg_conv.is_owned = false;
31933         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
31934 }
31935
31936 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
31937         LDKChainMonitor this_arg_conv;
31938         this_arg_conv.inner = untag_ptr(this_arg);
31939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31941         this_arg_conv.is_owned = false;
31942         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
31943         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
31944         return tag_ptr(ret_ret, true);
31945 }
31946
31947 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
31948         LDKChainMonitor this_arg_conv;
31949         this_arg_conv.inner = untag_ptr(this_arg);
31950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31952         this_arg_conv.is_owned = false;
31953         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
31954         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
31955         return tag_ptr(ret_ret, true);
31956 }
31957
31958 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
31959         LDKChainMonitor this_arg_conv;
31960         this_arg_conv.inner = untag_ptr(this_arg);
31961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31963         this_arg_conv.is_owned = false;
31964         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
31965         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
31966         return tag_ptr(ret_ret, true);
31967 }
31968
31969 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
31970         LDKChainMonitor this_arg_conv;
31971         this_arg_conv.inner = untag_ptr(this_arg);
31972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31974         this_arg_conv.is_owned = false;
31975         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
31976         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
31977         return tag_ptr(ret_ret, true);
31978 }
31979
31980 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
31981         LDKChannelMonitorUpdate this_obj_conv;
31982         this_obj_conv.inner = untag_ptr(this_obj);
31983         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31985         ChannelMonitorUpdate_free(this_obj_conv);
31986 }
31987
31988 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
31989         LDKChannelMonitorUpdate this_ptr_conv;
31990         this_ptr_conv.inner = untag_ptr(this_ptr);
31991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31993         this_ptr_conv.is_owned = false;
31994         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
31995         return ret_conv;
31996 }
31997
31998 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
31999         LDKChannelMonitorUpdate this_ptr_conv;
32000         this_ptr_conv.inner = untag_ptr(this_ptr);
32001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32003         this_ptr_conv.is_owned = false;
32004         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
32005 }
32006
32007 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
32008         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
32009         uint64_t ret_ref = 0;
32010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32012         return ret_ref;
32013 }
32014 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
32015         LDKChannelMonitorUpdate arg_conv;
32016         arg_conv.inner = untag_ptr(arg);
32017         arg_conv.is_owned = ptr_is_owned(arg);
32018         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32019         arg_conv.is_owned = false;
32020         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
32021         return ret_conv;
32022 }
32023
32024 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
32025         LDKChannelMonitorUpdate orig_conv;
32026         orig_conv.inner = untag_ptr(orig);
32027         orig_conv.is_owned = ptr_is_owned(orig);
32028         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32029         orig_conv.is_owned = false;
32030         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
32031         uint64_t ret_ref = 0;
32032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32034         return ret_ref;
32035 }
32036
32037 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
32038         LDKChannelMonitorUpdate a_conv;
32039         a_conv.inner = untag_ptr(a);
32040         a_conv.is_owned = ptr_is_owned(a);
32041         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32042         a_conv.is_owned = false;
32043         LDKChannelMonitorUpdate b_conv;
32044         b_conv.inner = untag_ptr(b);
32045         b_conv.is_owned = ptr_is_owned(b);
32046         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32047         b_conv.is_owned = false;
32048         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
32049         return ret_conv;
32050 }
32051
32052 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
32053         LDKChannelMonitorUpdate obj_conv;
32054         obj_conv.inner = untag_ptr(obj);
32055         obj_conv.is_owned = ptr_is_owned(obj);
32056         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32057         obj_conv.is_owned = false;
32058         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
32059         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32060         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32061         CVec_u8Z_free(ret_var);
32062         return ret_arr;
32063 }
32064
32065 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
32066         LDKu8slice ser_ref;
32067         ser_ref.datalen = ser->arr_len;
32068         ser_ref.data = ser->elems;
32069         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
32070         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
32071         FREE(ser);
32072         return tag_ptr(ret_conv, true);
32073 }
32074
32075 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
32076         if (!ptr_is_owned(this_ptr)) return;
32077         void* this_ptr_ptr = untag_ptr(this_ptr);
32078         CHECK_ACCESS(this_ptr_ptr);
32079         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
32080         FREE(untag_ptr(this_ptr));
32081         MonitorEvent_free(this_ptr_conv);
32082 }
32083
32084 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
32085         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32086         *ret_copy = MonitorEvent_clone(arg);
32087         uint64_t ret_ref = tag_ptr(ret_copy, true);
32088         return ret_ref;
32089 }
32090 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
32091         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
32092         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
32093         return ret_conv;
32094 }
32095
32096 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
32097         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
32098         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32099         *ret_copy = MonitorEvent_clone(orig_conv);
32100         uint64_t ret_ref = tag_ptr(ret_copy, true);
32101         return ret_ref;
32102 }
32103
32104 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
32105         LDKHTLCUpdate a_conv;
32106         a_conv.inner = untag_ptr(a);
32107         a_conv.is_owned = ptr_is_owned(a);
32108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32109         a_conv = HTLCUpdate_clone(&a_conv);
32110         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32111         *ret_copy = MonitorEvent_htlcevent(a_conv);
32112         uint64_t ret_ref = tag_ptr(ret_copy, true);
32113         return ret_ref;
32114 }
32115
32116 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
32117         LDKOutPoint a_conv;
32118         a_conv.inner = untag_ptr(a);
32119         a_conv.is_owned = ptr_is_owned(a);
32120         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32121         a_conv = OutPoint_clone(&a_conv);
32122         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32123         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
32124         uint64_t ret_ref = tag_ptr(ret_copy, true);
32125         return ret_ref;
32126 }
32127
32128 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
32129         LDKOutPoint funding_txo_conv;
32130         funding_txo_conv.inner = untag_ptr(funding_txo);
32131         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
32132         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
32133         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
32134         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32135         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
32136         uint64_t ret_ref = tag_ptr(ret_copy, true);
32137         return ret_ref;
32138 }
32139
32140 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
32141         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
32142         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
32143         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
32144         return ret_conv;
32145 }
32146
32147 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
32148         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
32149         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
32150         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32151         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32152         CVec_u8Z_free(ret_var);
32153         return ret_arr;
32154 }
32155
32156 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
32157         LDKu8slice ser_ref;
32158         ser_ref.datalen = ser->arr_len;
32159         ser_ref.data = ser->elems;
32160         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
32161         *ret_conv = MonitorEvent_read(ser_ref);
32162         FREE(ser);
32163         return tag_ptr(ret_conv, true);
32164 }
32165
32166 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
32167         LDKHTLCUpdate this_obj_conv;
32168         this_obj_conv.inner = untag_ptr(this_obj);
32169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32171         HTLCUpdate_free(this_obj_conv);
32172 }
32173
32174 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
32175         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
32176         uint64_t ret_ref = 0;
32177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32179         return ret_ref;
32180 }
32181 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
32182         LDKHTLCUpdate arg_conv;
32183         arg_conv.inner = untag_ptr(arg);
32184         arg_conv.is_owned = ptr_is_owned(arg);
32185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32186         arg_conv.is_owned = false;
32187         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
32188         return ret_conv;
32189 }
32190
32191 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
32192         LDKHTLCUpdate orig_conv;
32193         orig_conv.inner = untag_ptr(orig);
32194         orig_conv.is_owned = ptr_is_owned(orig);
32195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32196         orig_conv.is_owned = false;
32197         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
32198         uint64_t ret_ref = 0;
32199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32201         return ret_ref;
32202 }
32203
32204 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
32205         LDKHTLCUpdate a_conv;
32206         a_conv.inner = untag_ptr(a);
32207         a_conv.is_owned = ptr_is_owned(a);
32208         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32209         a_conv.is_owned = false;
32210         LDKHTLCUpdate b_conv;
32211         b_conv.inner = untag_ptr(b);
32212         b_conv.is_owned = ptr_is_owned(b);
32213         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32214         b_conv.is_owned = false;
32215         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
32216         return ret_conv;
32217 }
32218
32219 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
32220         LDKHTLCUpdate obj_conv;
32221         obj_conv.inner = untag_ptr(obj);
32222         obj_conv.is_owned = ptr_is_owned(obj);
32223         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32224         obj_conv.is_owned = false;
32225         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
32226         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32227         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32228         CVec_u8Z_free(ret_var);
32229         return ret_arr;
32230 }
32231
32232 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
32233         LDKu8slice ser_ref;
32234         ser_ref.datalen = ser->arr_len;
32235         ser_ref.data = ser->elems;
32236         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
32237         *ret_conv = HTLCUpdate_read(ser_ref);
32238         FREE(ser);
32239         return tag_ptr(ret_conv, true);
32240 }
32241
32242 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
32243         if (!ptr_is_owned(this_ptr)) return;
32244         void* this_ptr_ptr = untag_ptr(this_ptr);
32245         CHECK_ACCESS(this_ptr_ptr);
32246         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
32247         FREE(untag_ptr(this_ptr));
32248         Balance_free(this_ptr_conv);
32249 }
32250
32251 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
32252         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32253         *ret_copy = Balance_clone(arg);
32254         uint64_t ret_ref = tag_ptr(ret_copy, true);
32255         return ret_ref;
32256 }
32257 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
32258         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
32259         int64_t ret_conv = Balance_clone_ptr(arg_conv);
32260         return ret_conv;
32261 }
32262
32263 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
32264         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
32265         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32266         *ret_copy = Balance_clone(orig_conv);
32267         uint64_t ret_ref = tag_ptr(ret_copy, true);
32268         return ret_ref;
32269 }
32270
32271 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
32272         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32273         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
32274         uint64_t ret_ref = tag_ptr(ret_copy, true);
32275         return ret_ref;
32276 }
32277
32278 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
32279         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32280         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
32281         uint64_t ret_ref = tag_ptr(ret_copy, true);
32282         return ret_ref;
32283 }
32284
32285 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) {
32286         LDKThirtyTwoBytes payment_hash_ref;
32287         CHECK(payment_hash->arr_len == 32);
32288         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32289         LDKThirtyTwoBytes payment_preimage_ref;
32290         CHECK(payment_preimage->arr_len == 32);
32291         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
32292         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32293         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
32294         uint64_t ret_ref = tag_ptr(ret_copy, true);
32295         return ret_ref;
32296 }
32297
32298 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) {
32299         LDKThirtyTwoBytes payment_hash_ref;
32300         CHECK(payment_hash->arr_len == 32);
32301         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32302         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32303         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
32304         uint64_t ret_ref = tag_ptr(ret_copy, true);
32305         return ret_ref;
32306 }
32307
32308 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) {
32309         LDKThirtyTwoBytes payment_hash_ref;
32310         CHECK(payment_hash->arr_len == 32);
32311         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32312         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32313         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
32314         uint64_t ret_ref = tag_ptr(ret_copy, true);
32315         return ret_ref;
32316 }
32317
32318 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
32319         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32320         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
32321         uint64_t ret_ref = tag_ptr(ret_copy, true);
32322         return ret_ref;
32323 }
32324
32325 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
32326         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
32327         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
32328         jboolean ret_conv = Balance_eq(a_conv, b_conv);
32329         return ret_conv;
32330 }
32331
32332 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
32333         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
32334         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
32335         return ret_conv;
32336 }
32337
32338 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
32339         LDKChannelMonitor this_obj_conv;
32340         this_obj_conv.inner = untag_ptr(this_obj);
32341         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32343         ChannelMonitor_free(this_obj_conv);
32344 }
32345
32346 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
32347         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
32348         uint64_t ret_ref = 0;
32349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32351         return ret_ref;
32352 }
32353 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
32354         LDKChannelMonitor arg_conv;
32355         arg_conv.inner = untag_ptr(arg);
32356         arg_conv.is_owned = ptr_is_owned(arg);
32357         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32358         arg_conv.is_owned = false;
32359         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
32360         return ret_conv;
32361 }
32362
32363 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
32364         LDKChannelMonitor orig_conv;
32365         orig_conv.inner = untag_ptr(orig);
32366         orig_conv.is_owned = ptr_is_owned(orig);
32367         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32368         orig_conv.is_owned = false;
32369         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
32370         uint64_t ret_ref = 0;
32371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32373         return ret_ref;
32374 }
32375
32376 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
32377         LDKChannelMonitor obj_conv;
32378         obj_conv.inner = untag_ptr(obj);
32379         obj_conv.is_owned = ptr_is_owned(obj);
32380         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32381         obj_conv.is_owned = false;
32382         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
32383         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32384         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32385         CVec_u8Z_free(ret_var);
32386         return ret_arr;
32387 }
32388
32389 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) {
32390         LDKChannelMonitor this_arg_conv;
32391         this_arg_conv.inner = untag_ptr(this_arg);
32392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32394         this_arg_conv.is_owned = false;
32395         LDKChannelMonitorUpdate updates_conv;
32396         updates_conv.inner = untag_ptr(updates);
32397         updates_conv.is_owned = ptr_is_owned(updates);
32398         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
32399         updates_conv.is_owned = false;
32400         void* broadcaster_ptr = untag_ptr(broadcaster);
32401         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32402         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32403         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32404         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32405         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32406         void* logger_ptr = untag_ptr(logger);
32407         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
32408         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
32409         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
32410         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
32411         return tag_ptr(ret_conv, true);
32412 }
32413
32414 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
32415         LDKChannelMonitor this_arg_conv;
32416         this_arg_conv.inner = untag_ptr(this_arg);
32417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32419         this_arg_conv.is_owned = false;
32420         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
32421         return ret_conv;
32422 }
32423
32424 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
32425         LDKChannelMonitor this_arg_conv;
32426         this_arg_conv.inner = untag_ptr(this_arg);
32427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32429         this_arg_conv.is_owned = false;
32430         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
32431         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
32432         return tag_ptr(ret_conv, true);
32433 }
32434
32435 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
32436         LDKChannelMonitor this_arg_conv;
32437         this_arg_conv.inner = untag_ptr(this_arg);
32438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32440         this_arg_conv.is_owned = false;
32441         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
32442         uint64_tArray ret_arr = NULL;
32443         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32444         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32445         for (size_t a = 0; a < ret_var.datalen; a++) {
32446                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
32447                 *ret_conv_52_conv = ret_var.data[a];
32448                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
32449         }
32450         
32451         FREE(ret_var.data);
32452         return ret_arr;
32453 }
32454
32455 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
32456         LDKChannelMonitor this_arg_conv;
32457         this_arg_conv.inner = untag_ptr(this_arg);
32458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32460         this_arg_conv.is_owned = false;
32461         void* filter_ptr = untag_ptr(filter);
32462         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
32463         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
32464         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
32465 }
32466
32467 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) {
32468         LDKChannelMonitor this_arg_conv;
32469         this_arg_conv.inner = untag_ptr(this_arg);
32470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32472         this_arg_conv.is_owned = false;
32473         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
32474         uint64_tArray ret_arr = NULL;
32475         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32476         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32477         for (size_t o = 0; o < ret_var.datalen; o++) {
32478                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32479                 *ret_conv_14_copy = ret_var.data[o];
32480                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
32481                 ret_arr_ptr[o] = ret_conv_14_ref;
32482         }
32483         
32484         FREE(ret_var.data);
32485         return ret_arr;
32486 }
32487
32488 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
32489         LDKChannelMonitor this_arg_conv;
32490         this_arg_conv.inner = untag_ptr(this_arg);
32491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32493         this_arg_conv.is_owned = false;
32494         void* handler_ptr = untag_ptr(handler);
32495         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
32496         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
32497         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
32498 }
32499
32500 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
32501         LDKChannelMonitor this_arg_conv;
32502         this_arg_conv.inner = untag_ptr(this_arg);
32503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32505         this_arg_conv.is_owned = false;
32506         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
32507         uint64_t ret_ref = 0;
32508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32510         return ret_ref;
32511 }
32512
32513 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_counterparty_commitment_txs_from_update"))) TS_ChannelMonitor_counterparty_commitment_txs_from_update(uint64_t this_arg, uint64_t update) {
32514         LDKChannelMonitor this_arg_conv;
32515         this_arg_conv.inner = untag_ptr(this_arg);
32516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32518         this_arg_conv.is_owned = false;
32519         LDKChannelMonitorUpdate update_conv;
32520         update_conv.inner = untag_ptr(update);
32521         update_conv.is_owned = ptr_is_owned(update);
32522         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
32523         update_conv.is_owned = false;
32524         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
32525         uint64_tArray ret_arr = NULL;
32526         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32527         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32528         for (size_t x = 0; x < ret_var.datalen; x++) {
32529                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
32530                 uint64_t ret_conv_23_ref = 0;
32531                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
32532                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
32533                 ret_arr_ptr[x] = ret_conv_23_ref;
32534         }
32535         
32536         FREE(ret_var.data);
32537         return ret_arr;
32538 }
32539
32540 uint64_t  __attribute__((export_name("TS_ChannelMonitor_sign_to_local_justice_tx"))) TS_ChannelMonitor_sign_to_local_justice_tx(uint64_t this_arg, int8_tArray justice_tx, uint32_t input_idx, int64_t value, int64_t commitment_number) {
32541         LDKChannelMonitor this_arg_conv;
32542         this_arg_conv.inner = untag_ptr(this_arg);
32543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32545         this_arg_conv.is_owned = false;
32546         LDKTransaction justice_tx_ref;
32547         justice_tx_ref.datalen = justice_tx->arr_len;
32548         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
32549         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
32550         justice_tx_ref.data_is_owned = true;
32551         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
32552         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
32553         return tag_ptr(ret_conv, true);
32554 }
32555
32556 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
32557         LDKChannelMonitor this_arg_conv;
32558         this_arg_conv.inner = untag_ptr(this_arg);
32559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32561         this_arg_conv.is_owned = false;
32562         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32563         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
32564         return ret_arr;
32565 }
32566
32567 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) {
32568         LDKChannelMonitor this_arg_conv;
32569         this_arg_conv.inner = untag_ptr(this_arg);
32570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32572         this_arg_conv.is_owned = false;
32573         void* logger_ptr = untag_ptr(logger);
32574         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
32575         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
32576         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
32577         ptrArray ret_arr = NULL;
32578         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32579         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
32580         for (size_t m = 0; m < ret_var.datalen; m++) {
32581                 LDKTransaction ret_conv_12_var = ret_var.data[m];
32582                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
32583                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
32584                 Transaction_free(ret_conv_12_var);
32585                 ret_arr_ptr[m] = ret_conv_12_arr;
32586         }
32587         
32588         FREE(ret_var.data);
32589         return ret_arr;
32590 }
32591
32592 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) {
32593         LDKChannelMonitor this_arg_conv;
32594         this_arg_conv.inner = untag_ptr(this_arg);
32595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32597         this_arg_conv.is_owned = false;
32598         uint8_t header_arr[80];
32599         CHECK(header->arr_len == 80);
32600         memcpy(header_arr, header->elems, 80); FREE(header);
32601         uint8_t (*header_ref)[80] = &header_arr;
32602         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
32603         txdata_constr.datalen = txdata->arr_len;
32604         if (txdata_constr.datalen > 0)
32605                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
32606         else
32607                 txdata_constr.data = NULL;
32608         uint64_t* txdata_vals = txdata->elems;
32609         for (size_t c = 0; c < txdata_constr.datalen; c++) {
32610                 uint64_t txdata_conv_28 = txdata_vals[c];
32611                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
32612                 CHECK_ACCESS(txdata_conv_28_ptr);
32613                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
32614                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
32615                 txdata_constr.data[c] = txdata_conv_28_conv;
32616         }
32617         FREE(txdata);
32618         void* broadcaster_ptr = untag_ptr(broadcaster);
32619         CHECK_ACCESS(broadcaster_ptr);
32620         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32621         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32622                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32623                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32624         }
32625         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32626         CHECK_ACCESS(fee_estimator_ptr);
32627         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32628         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32629                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32630                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32631         }
32632         void* logger_ptr = untag_ptr(logger);
32633         CHECK_ACCESS(logger_ptr);
32634         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32635         if (logger_conv.free == LDKLogger_JCalls_free) {
32636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32637                 LDKLogger_JCalls_cloned(&logger_conv);
32638         }
32639         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
32640         uint64_tArray ret_arr = NULL;
32641         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32642         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32643         for (size_t x = 0; x < ret_var.datalen; x++) {
32644                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
32645                 *ret_conv_49_conv = ret_var.data[x];
32646                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
32647         }
32648         
32649         FREE(ret_var.data);
32650         return ret_arr;
32651 }
32652
32653 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) {
32654         LDKChannelMonitor this_arg_conv;
32655         this_arg_conv.inner = untag_ptr(this_arg);
32656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32658         this_arg_conv.is_owned = false;
32659         uint8_t header_arr[80];
32660         CHECK(header->arr_len == 80);
32661         memcpy(header_arr, header->elems, 80); FREE(header);
32662         uint8_t (*header_ref)[80] = &header_arr;
32663         void* broadcaster_ptr = untag_ptr(broadcaster);
32664         CHECK_ACCESS(broadcaster_ptr);
32665         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32666         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32667                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32668                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32669         }
32670         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32671         CHECK_ACCESS(fee_estimator_ptr);
32672         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32673         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32674                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32675                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32676         }
32677         void* logger_ptr = untag_ptr(logger);
32678         CHECK_ACCESS(logger_ptr);
32679         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32680         if (logger_conv.free == LDKLogger_JCalls_free) {
32681                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32682                 LDKLogger_JCalls_cloned(&logger_conv);
32683         }
32684         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
32685 }
32686
32687 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) {
32688         LDKChannelMonitor this_arg_conv;
32689         this_arg_conv.inner = untag_ptr(this_arg);
32690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32692         this_arg_conv.is_owned = false;
32693         uint8_t header_arr[80];
32694         CHECK(header->arr_len == 80);
32695         memcpy(header_arr, header->elems, 80); FREE(header);
32696         uint8_t (*header_ref)[80] = &header_arr;
32697         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
32698         txdata_constr.datalen = txdata->arr_len;
32699         if (txdata_constr.datalen > 0)
32700                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
32701         else
32702                 txdata_constr.data = NULL;
32703         uint64_t* txdata_vals = txdata->elems;
32704         for (size_t c = 0; c < txdata_constr.datalen; c++) {
32705                 uint64_t txdata_conv_28 = txdata_vals[c];
32706                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
32707                 CHECK_ACCESS(txdata_conv_28_ptr);
32708                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
32709                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
32710                 txdata_constr.data[c] = txdata_conv_28_conv;
32711         }
32712         FREE(txdata);
32713         void* broadcaster_ptr = untag_ptr(broadcaster);
32714         CHECK_ACCESS(broadcaster_ptr);
32715         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32716         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32717                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32718                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32719         }
32720         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32721         CHECK_ACCESS(fee_estimator_ptr);
32722         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32723         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32724                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32725                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32726         }
32727         void* logger_ptr = untag_ptr(logger);
32728         CHECK_ACCESS(logger_ptr);
32729         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32730         if (logger_conv.free == LDKLogger_JCalls_free) {
32731                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32732                 LDKLogger_JCalls_cloned(&logger_conv);
32733         }
32734         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
32735         uint64_tArray ret_arr = NULL;
32736         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32737         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32738         for (size_t x = 0; x < ret_var.datalen; x++) {
32739                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
32740                 *ret_conv_49_conv = ret_var.data[x];
32741                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
32742         }
32743         
32744         FREE(ret_var.data);
32745         return ret_arr;
32746 }
32747
32748 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) {
32749         LDKChannelMonitor this_arg_conv;
32750         this_arg_conv.inner = untag_ptr(this_arg);
32751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32753         this_arg_conv.is_owned = false;
32754         uint8_t txid_arr[32];
32755         CHECK(txid->arr_len == 32);
32756         memcpy(txid_arr, txid->elems, 32); FREE(txid);
32757         uint8_t (*txid_ref)[32] = &txid_arr;
32758         void* broadcaster_ptr = untag_ptr(broadcaster);
32759         CHECK_ACCESS(broadcaster_ptr);
32760         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32761         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32763                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32764         }
32765         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32766         CHECK_ACCESS(fee_estimator_ptr);
32767         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32768         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32769                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32770                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32771         }
32772         void* logger_ptr = untag_ptr(logger);
32773         CHECK_ACCESS(logger_ptr);
32774         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32775         if (logger_conv.free == LDKLogger_JCalls_free) {
32776                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32777                 LDKLogger_JCalls_cloned(&logger_conv);
32778         }
32779         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
32780 }
32781
32782 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) {
32783         LDKChannelMonitor this_arg_conv;
32784         this_arg_conv.inner = untag_ptr(this_arg);
32785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32787         this_arg_conv.is_owned = false;
32788         uint8_t header_arr[80];
32789         CHECK(header->arr_len == 80);
32790         memcpy(header_arr, header->elems, 80); FREE(header);
32791         uint8_t (*header_ref)[80] = &header_arr;
32792         void* broadcaster_ptr = untag_ptr(broadcaster);
32793         CHECK_ACCESS(broadcaster_ptr);
32794         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32795         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32796                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32797                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32798         }
32799         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32800         CHECK_ACCESS(fee_estimator_ptr);
32801         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32802         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32803                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32804                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32805         }
32806         void* logger_ptr = untag_ptr(logger);
32807         CHECK_ACCESS(logger_ptr);
32808         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32809         if (logger_conv.free == LDKLogger_JCalls_free) {
32810                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32811                 LDKLogger_JCalls_cloned(&logger_conv);
32812         }
32813         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
32814         uint64_tArray ret_arr = NULL;
32815         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32816         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32817         for (size_t x = 0; x < ret_var.datalen; x++) {
32818                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
32819                 *ret_conv_49_conv = ret_var.data[x];
32820                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
32821         }
32822         
32823         FREE(ret_var.data);
32824         return ret_arr;
32825 }
32826
32827 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
32828         LDKChannelMonitor this_arg_conv;
32829         this_arg_conv.inner = untag_ptr(this_arg);
32830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32832         this_arg_conv.is_owned = false;
32833         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
32834         uint64_tArray ret_arr = NULL;
32835         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32836         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32837         for (size_t x = 0; x < ret_var.datalen; x++) {
32838                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
32839                 *ret_conv_49_conv = ret_var.data[x];
32840                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
32841         }
32842         
32843         FREE(ret_var.data);
32844         return ret_arr;
32845 }
32846
32847 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
32848         LDKChannelMonitor this_arg_conv;
32849         this_arg_conv.inner = untag_ptr(this_arg);
32850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32852         this_arg_conv.is_owned = false;
32853         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
32854         uint64_t ret_ref = 0;
32855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32857         return ret_ref;
32858 }
32859
32860 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) {
32861         LDKChannelMonitor this_arg_conv;
32862         this_arg_conv.inner = untag_ptr(this_arg);
32863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32865         this_arg_conv.is_owned = false;
32866         void* broadcaster_ptr = untag_ptr(broadcaster);
32867         CHECK_ACCESS(broadcaster_ptr);
32868         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32869         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32870                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32871                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32872         }
32873         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32874         CHECK_ACCESS(fee_estimator_ptr);
32875         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32876         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32878                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32879         }
32880         void* logger_ptr = untag_ptr(logger);
32881         CHECK_ACCESS(logger_ptr);
32882         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32883         if (logger_conv.free == LDKLogger_JCalls_free) {
32884                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32885                 LDKLogger_JCalls_cloned(&logger_conv);
32886         }
32887         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
32888 }
32889
32890 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_spendable_outputs"))) TS_ChannelMonitor_get_spendable_outputs(uint64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
32891         LDKChannelMonitor this_arg_conv;
32892         this_arg_conv.inner = untag_ptr(this_arg);
32893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32895         this_arg_conv.is_owned = false;
32896         LDKTransaction tx_ref;
32897         tx_ref.datalen = tx->arr_len;
32898         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
32899         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
32900         tx_ref.data_is_owned = true;
32901         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
32902         uint64_tArray ret_arr = NULL;
32903         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32904         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32905         for (size_t b = 0; b < ret_var.datalen; b++) {
32906                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
32907                 *ret_conv_27_copy = ret_var.data[b];
32908                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
32909                 ret_arr_ptr[b] = ret_conv_27_ref;
32910         }
32911         
32912         FREE(ret_var.data);
32913         return ret_arr;
32914 }
32915
32916 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
32917         LDKChannelMonitor this_arg_conv;
32918         this_arg_conv.inner = untag_ptr(this_arg);
32919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32921         this_arg_conv.is_owned = false;
32922         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
32923         uint64_tArray ret_arr = NULL;
32924         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32925         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32926         for (size_t j = 0; j < ret_var.datalen; j++) {
32927                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32928                 *ret_conv_9_copy = ret_var.data[j];
32929                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
32930                 ret_arr_ptr[j] = ret_conv_9_ref;
32931         }
32932         
32933         FREE(ret_var.data);
32934         return ret_arr;
32935 }
32936
32937 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
32938         LDKu8slice ser_ref;
32939         ser_ref.datalen = ser->arr_len;
32940         ser_ref.data = ser->elems;
32941         void* arg_a_ptr = untag_ptr(arg_a);
32942         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
32943         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
32944         void* arg_b_ptr = untag_ptr(arg_b);
32945         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
32946         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
32947         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
32948         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
32949         FREE(ser);
32950         return tag_ptr(ret_conv, true);
32951 }
32952
32953 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
32954         LDKOutPoint this_obj_conv;
32955         this_obj_conv.inner = untag_ptr(this_obj);
32956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32958         OutPoint_free(this_obj_conv);
32959 }
32960
32961 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
32962         LDKOutPoint this_ptr_conv;
32963         this_ptr_conv.inner = untag_ptr(this_ptr);
32964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32966         this_ptr_conv.is_owned = false;
32967         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32968         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
32969         return ret_arr;
32970 }
32971
32972 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
32973         LDKOutPoint this_ptr_conv;
32974         this_ptr_conv.inner = untag_ptr(this_ptr);
32975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32977         this_ptr_conv.is_owned = false;
32978         LDKThirtyTwoBytes val_ref;
32979         CHECK(val->arr_len == 32);
32980         memcpy(val_ref.data, val->elems, 32); FREE(val);
32981         OutPoint_set_txid(&this_ptr_conv, val_ref);
32982 }
32983
32984 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
32985         LDKOutPoint this_ptr_conv;
32986         this_ptr_conv.inner = untag_ptr(this_ptr);
32987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32989         this_ptr_conv.is_owned = false;
32990         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
32991         return ret_conv;
32992 }
32993
32994 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
32995         LDKOutPoint this_ptr_conv;
32996         this_ptr_conv.inner = untag_ptr(this_ptr);
32997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32999         this_ptr_conv.is_owned = false;
33000         OutPoint_set_index(&this_ptr_conv, val);
33001 }
33002
33003 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
33004         LDKThirtyTwoBytes txid_arg_ref;
33005         CHECK(txid_arg->arr_len == 32);
33006         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
33007         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
33008         uint64_t ret_ref = 0;
33009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33011         return ret_ref;
33012 }
33013
33014 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
33015         LDKOutPoint ret_var = OutPoint_clone(arg);
33016         uint64_t ret_ref = 0;
33017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33019         return ret_ref;
33020 }
33021 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
33022         LDKOutPoint arg_conv;
33023         arg_conv.inner = untag_ptr(arg);
33024         arg_conv.is_owned = ptr_is_owned(arg);
33025         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33026         arg_conv.is_owned = false;
33027         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
33028         return ret_conv;
33029 }
33030
33031 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
33032         LDKOutPoint orig_conv;
33033         orig_conv.inner = untag_ptr(orig);
33034         orig_conv.is_owned = ptr_is_owned(orig);
33035         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33036         orig_conv.is_owned = false;
33037         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
33038         uint64_t ret_ref = 0;
33039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33041         return ret_ref;
33042 }
33043
33044 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
33045         LDKOutPoint a_conv;
33046         a_conv.inner = untag_ptr(a);
33047         a_conv.is_owned = ptr_is_owned(a);
33048         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33049         a_conv.is_owned = false;
33050         LDKOutPoint b_conv;
33051         b_conv.inner = untag_ptr(b);
33052         b_conv.is_owned = ptr_is_owned(b);
33053         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33054         b_conv.is_owned = false;
33055         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
33056         return ret_conv;
33057 }
33058
33059 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
33060         LDKOutPoint o_conv;
33061         o_conv.inner = untag_ptr(o);
33062         o_conv.is_owned = ptr_is_owned(o);
33063         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33064         o_conv.is_owned = false;
33065         int64_t ret_conv = OutPoint_hash(&o_conv);
33066         return ret_conv;
33067 }
33068
33069 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
33070         LDKOutPoint this_arg_conv;
33071         this_arg_conv.inner = untag_ptr(this_arg);
33072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33074         this_arg_conv.is_owned = false;
33075         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33076         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
33077         return ret_arr;
33078 }
33079
33080 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
33081         LDKOutPoint obj_conv;
33082         obj_conv.inner = untag_ptr(obj);
33083         obj_conv.is_owned = ptr_is_owned(obj);
33084         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33085         obj_conv.is_owned = false;
33086         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
33087         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33088         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33089         CVec_u8Z_free(ret_var);
33090         return ret_arr;
33091 }
33092
33093 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
33094         LDKu8slice ser_ref;
33095         ser_ref.datalen = ser->arr_len;
33096         ser_ref.data = ser->elems;
33097         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33098         *ret_conv = OutPoint_read(ser_ref);
33099         FREE(ser);
33100         return tag_ptr(ret_conv, true);
33101 }
33102
33103 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
33104         if (!ptr_is_owned(this_ptr)) return;
33105         void* this_ptr_ptr = untag_ptr(this_ptr);
33106         CHECK_ACCESS(this_ptr_ptr);
33107         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
33108         FREE(untag_ptr(this_ptr));
33109         FailureCode_free(this_ptr_conv);
33110 }
33111
33112 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
33113         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33114         *ret_copy = FailureCode_clone(arg);
33115         uint64_t ret_ref = tag_ptr(ret_copy, true);
33116         return ret_ref;
33117 }
33118 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
33119         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
33120         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
33121         return ret_conv;
33122 }
33123
33124 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
33125         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
33126         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33127         *ret_copy = FailureCode_clone(orig_conv);
33128         uint64_t ret_ref = tag_ptr(ret_copy, true);
33129         return ret_ref;
33130 }
33131
33132 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
33133         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33134         *ret_copy = FailureCode_temporary_node_failure();
33135         uint64_t ret_ref = tag_ptr(ret_copy, true);
33136         return ret_ref;
33137 }
33138
33139 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
33140         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33141         *ret_copy = FailureCode_required_node_feature_missing();
33142         uint64_t ret_ref = tag_ptr(ret_copy, true);
33143         return ret_ref;
33144 }
33145
33146 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
33147         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33148         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
33149         uint64_t ret_ref = tag_ptr(ret_copy, true);
33150         return ret_ref;
33151 }
33152
33153 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
33154         void* a_ptr = untag_ptr(a);
33155         CHECK_ACCESS(a_ptr);
33156         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
33157         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
33158         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33159         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
33160         uint64_t ret_ref = tag_ptr(ret_copy, true);
33161         return ret_ref;
33162 }
33163
33164 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
33165         LDKChannelManager this_obj_conv;
33166         this_obj_conv.inner = untag_ptr(this_obj);
33167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33169         ChannelManager_free(this_obj_conv);
33170 }
33171
33172 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
33173         LDKChainParameters this_obj_conv;
33174         this_obj_conv.inner = untag_ptr(this_obj);
33175         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33177         ChainParameters_free(this_obj_conv);
33178 }
33179
33180 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
33181         LDKChainParameters this_ptr_conv;
33182         this_ptr_conv.inner = untag_ptr(this_ptr);
33183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33185         this_ptr_conv.is_owned = false;
33186         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
33187         return ret_conv;
33188 }
33189
33190 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
33191         LDKChainParameters this_ptr_conv;
33192         this_ptr_conv.inner = untag_ptr(this_ptr);
33193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33195         this_ptr_conv.is_owned = false;
33196         LDKNetwork val_conv = LDKNetwork_from_js(val);
33197         ChainParameters_set_network(&this_ptr_conv, val_conv);
33198 }
33199
33200 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
33201         LDKChainParameters this_ptr_conv;
33202         this_ptr_conv.inner = untag_ptr(this_ptr);
33203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33205         this_ptr_conv.is_owned = false;
33206         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
33207         uint64_t ret_ref = 0;
33208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33210         return ret_ref;
33211 }
33212
33213 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
33214         LDKChainParameters this_ptr_conv;
33215         this_ptr_conv.inner = untag_ptr(this_ptr);
33216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33218         this_ptr_conv.is_owned = false;
33219         LDKBestBlock val_conv;
33220         val_conv.inner = untag_ptr(val);
33221         val_conv.is_owned = ptr_is_owned(val);
33222         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33223         val_conv = BestBlock_clone(&val_conv);
33224         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
33225 }
33226
33227 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
33228         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
33229         LDKBestBlock best_block_arg_conv;
33230         best_block_arg_conv.inner = untag_ptr(best_block_arg);
33231         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
33232         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
33233         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
33234         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
33235         uint64_t ret_ref = 0;
33236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33238         return ret_ref;
33239 }
33240
33241 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
33242         LDKChainParameters ret_var = ChainParameters_clone(arg);
33243         uint64_t ret_ref = 0;
33244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33246         return ret_ref;
33247 }
33248 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
33249         LDKChainParameters arg_conv;
33250         arg_conv.inner = untag_ptr(arg);
33251         arg_conv.is_owned = ptr_is_owned(arg);
33252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33253         arg_conv.is_owned = false;
33254         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
33255         return ret_conv;
33256 }
33257
33258 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
33259         LDKChainParameters orig_conv;
33260         orig_conv.inner = untag_ptr(orig);
33261         orig_conv.is_owned = ptr_is_owned(orig);
33262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33263         orig_conv.is_owned = false;
33264         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
33265         uint64_t ret_ref = 0;
33266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33268         return ret_ref;
33269 }
33270
33271 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
33272         LDKCounterpartyForwardingInfo this_obj_conv;
33273         this_obj_conv.inner = untag_ptr(this_obj);
33274         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33276         CounterpartyForwardingInfo_free(this_obj_conv);
33277 }
33278
33279 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
33280         LDKCounterpartyForwardingInfo this_ptr_conv;
33281         this_ptr_conv.inner = untag_ptr(this_ptr);
33282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33284         this_ptr_conv.is_owned = false;
33285         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
33286         return ret_conv;
33287 }
33288
33289 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
33290         LDKCounterpartyForwardingInfo this_ptr_conv;
33291         this_ptr_conv.inner = untag_ptr(this_ptr);
33292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33294         this_ptr_conv.is_owned = false;
33295         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
33296 }
33297
33298 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
33299         LDKCounterpartyForwardingInfo this_ptr_conv;
33300         this_ptr_conv.inner = untag_ptr(this_ptr);
33301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33303         this_ptr_conv.is_owned = false;
33304         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
33305         return ret_conv;
33306 }
33307
33308 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
33309         LDKCounterpartyForwardingInfo this_ptr_conv;
33310         this_ptr_conv.inner = untag_ptr(this_ptr);
33311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33313         this_ptr_conv.is_owned = false;
33314         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
33315 }
33316
33317 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
33318         LDKCounterpartyForwardingInfo this_ptr_conv;
33319         this_ptr_conv.inner = untag_ptr(this_ptr);
33320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33322         this_ptr_conv.is_owned = false;
33323         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
33324         return ret_conv;
33325 }
33326
33327 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
33328         LDKCounterpartyForwardingInfo this_ptr_conv;
33329         this_ptr_conv.inner = untag_ptr(this_ptr);
33330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33332         this_ptr_conv.is_owned = false;
33333         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
33334 }
33335
33336 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) {
33337         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
33338         uint64_t ret_ref = 0;
33339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33341         return ret_ref;
33342 }
33343
33344 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
33345         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
33346         uint64_t ret_ref = 0;
33347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33349         return ret_ref;
33350 }
33351 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
33352         LDKCounterpartyForwardingInfo arg_conv;
33353         arg_conv.inner = untag_ptr(arg);
33354         arg_conv.is_owned = ptr_is_owned(arg);
33355         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33356         arg_conv.is_owned = false;
33357         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
33358         return ret_conv;
33359 }
33360
33361 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
33362         LDKCounterpartyForwardingInfo orig_conv;
33363         orig_conv.inner = untag_ptr(orig);
33364         orig_conv.is_owned = ptr_is_owned(orig);
33365         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33366         orig_conv.is_owned = false;
33367         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
33368         uint64_t ret_ref = 0;
33369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33371         return ret_ref;
33372 }
33373
33374 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
33375         LDKChannelCounterparty this_obj_conv;
33376         this_obj_conv.inner = untag_ptr(this_obj);
33377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33379         ChannelCounterparty_free(this_obj_conv);
33380 }
33381
33382 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
33383         LDKChannelCounterparty this_ptr_conv;
33384         this_ptr_conv.inner = untag_ptr(this_ptr);
33385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33387         this_ptr_conv.is_owned = false;
33388         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33389         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
33390         return ret_arr;
33391 }
33392
33393 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
33394         LDKChannelCounterparty this_ptr_conv;
33395         this_ptr_conv.inner = untag_ptr(this_ptr);
33396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33398         this_ptr_conv.is_owned = false;
33399         LDKPublicKey val_ref;
33400         CHECK(val->arr_len == 33);
33401         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33402         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
33403 }
33404
33405 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
33406         LDKChannelCounterparty this_ptr_conv;
33407         this_ptr_conv.inner = untag_ptr(this_ptr);
33408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33410         this_ptr_conv.is_owned = false;
33411         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
33412         uint64_t ret_ref = 0;
33413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33415         return ret_ref;
33416 }
33417
33418 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
33419         LDKChannelCounterparty this_ptr_conv;
33420         this_ptr_conv.inner = untag_ptr(this_ptr);
33421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33423         this_ptr_conv.is_owned = false;
33424         LDKInitFeatures val_conv;
33425         val_conv.inner = untag_ptr(val);
33426         val_conv.is_owned = ptr_is_owned(val);
33427         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33428         val_conv = InitFeatures_clone(&val_conv);
33429         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
33430 }
33431
33432 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
33433         LDKChannelCounterparty this_ptr_conv;
33434         this_ptr_conv.inner = untag_ptr(this_ptr);
33435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33437         this_ptr_conv.is_owned = false;
33438         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
33439         return ret_conv;
33440 }
33441
33442 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
33443         LDKChannelCounterparty this_ptr_conv;
33444         this_ptr_conv.inner = untag_ptr(this_ptr);
33445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33447         this_ptr_conv.is_owned = false;
33448         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
33449 }
33450
33451 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
33452         LDKChannelCounterparty this_ptr_conv;
33453         this_ptr_conv.inner = untag_ptr(this_ptr);
33454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33456         this_ptr_conv.is_owned = false;
33457         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
33458         uint64_t ret_ref = 0;
33459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33461         return ret_ref;
33462 }
33463
33464 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
33465         LDKChannelCounterparty this_ptr_conv;
33466         this_ptr_conv.inner = untag_ptr(this_ptr);
33467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33469         this_ptr_conv.is_owned = false;
33470         LDKCounterpartyForwardingInfo val_conv;
33471         val_conv.inner = untag_ptr(val);
33472         val_conv.is_owned = ptr_is_owned(val);
33473         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33474         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
33475         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
33476 }
33477
33478 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
33479         LDKChannelCounterparty this_ptr_conv;
33480         this_ptr_conv.inner = untag_ptr(this_ptr);
33481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33483         this_ptr_conv.is_owned = false;
33484         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33485         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
33486         uint64_t ret_ref = tag_ptr(ret_copy, true);
33487         return ret_ref;
33488 }
33489
33490 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) {
33491         LDKChannelCounterparty this_ptr_conv;
33492         this_ptr_conv.inner = untag_ptr(this_ptr);
33493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33495         this_ptr_conv.is_owned = false;
33496         void* val_ptr = untag_ptr(val);
33497         CHECK_ACCESS(val_ptr);
33498         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33499         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33500         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
33501 }
33502
33503 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
33504         LDKChannelCounterparty this_ptr_conv;
33505         this_ptr_conv.inner = untag_ptr(this_ptr);
33506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33508         this_ptr_conv.is_owned = false;
33509         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33510         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
33511         uint64_t ret_ref = tag_ptr(ret_copy, true);
33512         return ret_ref;
33513 }
33514
33515 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) {
33516         LDKChannelCounterparty this_ptr_conv;
33517         this_ptr_conv.inner = untag_ptr(this_ptr);
33518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33520         this_ptr_conv.is_owned = false;
33521         void* val_ptr = untag_ptr(val);
33522         CHECK_ACCESS(val_ptr);
33523         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33524         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33525         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
33526 }
33527
33528 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) {
33529         LDKPublicKey node_id_arg_ref;
33530         CHECK(node_id_arg->arr_len == 33);
33531         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
33532         LDKInitFeatures features_arg_conv;
33533         features_arg_conv.inner = untag_ptr(features_arg);
33534         features_arg_conv.is_owned = ptr_is_owned(features_arg);
33535         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
33536         features_arg_conv = InitFeatures_clone(&features_arg_conv);
33537         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
33538         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
33539         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
33540         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
33541         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
33542         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
33543         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
33544         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
33545         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
33546         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
33547         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
33548         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
33549         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
33550         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);
33551         uint64_t ret_ref = 0;
33552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33554         return ret_ref;
33555 }
33556
33557 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
33558         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
33559         uint64_t ret_ref = 0;
33560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33562         return ret_ref;
33563 }
33564 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
33565         LDKChannelCounterparty arg_conv;
33566         arg_conv.inner = untag_ptr(arg);
33567         arg_conv.is_owned = ptr_is_owned(arg);
33568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33569         arg_conv.is_owned = false;
33570         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
33571         return ret_conv;
33572 }
33573
33574 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
33575         LDKChannelCounterparty orig_conv;
33576         orig_conv.inner = untag_ptr(orig);
33577         orig_conv.is_owned = ptr_is_owned(orig);
33578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33579         orig_conv.is_owned = false;
33580         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
33581         uint64_t ret_ref = 0;
33582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33584         return ret_ref;
33585 }
33586
33587 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
33588         LDKChannelDetails this_obj_conv;
33589         this_obj_conv.inner = untag_ptr(this_obj);
33590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33592         ChannelDetails_free(this_obj_conv);
33593 }
33594
33595 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
33596         LDKChannelDetails this_ptr_conv;
33597         this_ptr_conv.inner = untag_ptr(this_ptr);
33598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33600         this_ptr_conv.is_owned = false;
33601         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33602         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
33603         return ret_arr;
33604 }
33605
33606 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33607         LDKChannelDetails this_ptr_conv;
33608         this_ptr_conv.inner = untag_ptr(this_ptr);
33609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33611         this_ptr_conv.is_owned = false;
33612         LDKThirtyTwoBytes val_ref;
33613         CHECK(val->arr_len == 32);
33614         memcpy(val_ref.data, val->elems, 32); FREE(val);
33615         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
33616 }
33617
33618 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
33619         LDKChannelDetails this_ptr_conv;
33620         this_ptr_conv.inner = untag_ptr(this_ptr);
33621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33623         this_ptr_conv.is_owned = false;
33624         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
33625         uint64_t ret_ref = 0;
33626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33628         return ret_ref;
33629 }
33630
33631 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
33632         LDKChannelDetails this_ptr_conv;
33633         this_ptr_conv.inner = untag_ptr(this_ptr);
33634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33636         this_ptr_conv.is_owned = false;
33637         LDKChannelCounterparty val_conv;
33638         val_conv.inner = untag_ptr(val);
33639         val_conv.is_owned = ptr_is_owned(val);
33640         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33641         val_conv = ChannelCounterparty_clone(&val_conv);
33642         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
33643 }
33644
33645 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
33646         LDKChannelDetails this_ptr_conv;
33647         this_ptr_conv.inner = untag_ptr(this_ptr);
33648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33650         this_ptr_conv.is_owned = false;
33651         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
33652         uint64_t ret_ref = 0;
33653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33655         return ret_ref;
33656 }
33657
33658 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
33659         LDKChannelDetails this_ptr_conv;
33660         this_ptr_conv.inner = untag_ptr(this_ptr);
33661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33663         this_ptr_conv.is_owned = false;
33664         LDKOutPoint val_conv;
33665         val_conv.inner = untag_ptr(val);
33666         val_conv.is_owned = ptr_is_owned(val);
33667         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33668         val_conv = OutPoint_clone(&val_conv);
33669         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
33670 }
33671
33672 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
33673         LDKChannelDetails this_ptr_conv;
33674         this_ptr_conv.inner = untag_ptr(this_ptr);
33675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33677         this_ptr_conv.is_owned = false;
33678         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
33679         uint64_t ret_ref = 0;
33680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33682         return ret_ref;
33683 }
33684
33685 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
33686         LDKChannelDetails this_ptr_conv;
33687         this_ptr_conv.inner = untag_ptr(this_ptr);
33688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33690         this_ptr_conv.is_owned = false;
33691         LDKChannelTypeFeatures val_conv;
33692         val_conv.inner = untag_ptr(val);
33693         val_conv.is_owned = ptr_is_owned(val);
33694         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33695         val_conv = ChannelTypeFeatures_clone(&val_conv);
33696         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
33697 }
33698
33699 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
33700         LDKChannelDetails this_ptr_conv;
33701         this_ptr_conv.inner = untag_ptr(this_ptr);
33702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33704         this_ptr_conv.is_owned = false;
33705         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33706         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
33707         uint64_t ret_ref = tag_ptr(ret_copy, true);
33708         return ret_ref;
33709 }
33710
33711 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
33712         LDKChannelDetails this_ptr_conv;
33713         this_ptr_conv.inner = untag_ptr(this_ptr);
33714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33716         this_ptr_conv.is_owned = false;
33717         void* val_ptr = untag_ptr(val);
33718         CHECK_ACCESS(val_ptr);
33719         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33720         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33721         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
33722 }
33723
33724 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
33725         LDKChannelDetails this_ptr_conv;
33726         this_ptr_conv.inner = untag_ptr(this_ptr);
33727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33729         this_ptr_conv.is_owned = false;
33730         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33731         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
33732         uint64_t ret_ref = tag_ptr(ret_copy, true);
33733         return ret_ref;
33734 }
33735
33736 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
33737         LDKChannelDetails this_ptr_conv;
33738         this_ptr_conv.inner = untag_ptr(this_ptr);
33739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33741         this_ptr_conv.is_owned = false;
33742         void* val_ptr = untag_ptr(val);
33743         CHECK_ACCESS(val_ptr);
33744         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33745         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33746         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
33747 }
33748
33749 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
33750         LDKChannelDetails this_ptr_conv;
33751         this_ptr_conv.inner = untag_ptr(this_ptr);
33752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33754         this_ptr_conv.is_owned = false;
33755         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33756         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
33757         uint64_t ret_ref = tag_ptr(ret_copy, true);
33758         return ret_ref;
33759 }
33760
33761 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
33762         LDKChannelDetails this_ptr_conv;
33763         this_ptr_conv.inner = untag_ptr(this_ptr);
33764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33766         this_ptr_conv.is_owned = false;
33767         void* val_ptr = untag_ptr(val);
33768         CHECK_ACCESS(val_ptr);
33769         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33770         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33771         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
33772 }
33773
33774 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
33775         LDKChannelDetails this_ptr_conv;
33776         this_ptr_conv.inner = untag_ptr(this_ptr);
33777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33779         this_ptr_conv.is_owned = false;
33780         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
33781         return ret_conv;
33782 }
33783
33784 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
33785         LDKChannelDetails this_ptr_conv;
33786         this_ptr_conv.inner = untag_ptr(this_ptr);
33787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33789         this_ptr_conv.is_owned = false;
33790         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
33791 }
33792
33793 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
33794         LDKChannelDetails this_ptr_conv;
33795         this_ptr_conv.inner = untag_ptr(this_ptr);
33796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33798         this_ptr_conv.is_owned = false;
33799         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33800         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
33801         uint64_t ret_ref = tag_ptr(ret_copy, true);
33802         return ret_ref;
33803 }
33804
33805 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
33806         LDKChannelDetails this_ptr_conv;
33807         this_ptr_conv.inner = untag_ptr(this_ptr);
33808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33810         this_ptr_conv.is_owned = false;
33811         void* val_ptr = untag_ptr(val);
33812         CHECK_ACCESS(val_ptr);
33813         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33814         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33815         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
33816 }
33817
33818 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
33819         LDKChannelDetails this_ptr_conv;
33820         this_ptr_conv.inner = untag_ptr(this_ptr);
33821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33823         this_ptr_conv.is_owned = false;
33824         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
33825         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
33826         return ret_arr;
33827 }
33828
33829 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
33830         LDKChannelDetails 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         LDKU128 val_ref;
33836         CHECK(val->arr_len == 16);
33837         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
33838         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
33839 }
33840
33841 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) {
33842         LDKChannelDetails this_ptr_conv;
33843         this_ptr_conv.inner = untag_ptr(this_ptr);
33844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33846         this_ptr_conv.is_owned = false;
33847         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33848         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
33849         uint64_t ret_ref = tag_ptr(ret_copy, true);
33850         return ret_ref;
33851 }
33852
33853 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) {
33854         LDKChannelDetails this_ptr_conv;
33855         this_ptr_conv.inner = untag_ptr(this_ptr);
33856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33858         this_ptr_conv.is_owned = false;
33859         void* val_ptr = untag_ptr(val);
33860         CHECK_ACCESS(val_ptr);
33861         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33862         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
33863         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
33864 }
33865
33866 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
33867         LDKChannelDetails this_ptr_conv;
33868         this_ptr_conv.inner = untag_ptr(this_ptr);
33869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33871         this_ptr_conv.is_owned = false;
33872         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
33873         return ret_conv;
33874 }
33875
33876 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
33877         LDKChannelDetails this_ptr_conv;
33878         this_ptr_conv.inner = untag_ptr(this_ptr);
33879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33881         this_ptr_conv.is_owned = false;
33882         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
33883 }
33884
33885 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
33886         LDKChannelDetails this_ptr_conv;
33887         this_ptr_conv.inner = untag_ptr(this_ptr);
33888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33890         this_ptr_conv.is_owned = false;
33891         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
33892         return ret_conv;
33893 }
33894
33895 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
33896         LDKChannelDetails this_ptr_conv;
33897         this_ptr_conv.inner = untag_ptr(this_ptr);
33898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33900         this_ptr_conv.is_owned = false;
33901         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
33902 }
33903
33904 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) {
33905         LDKChannelDetails this_ptr_conv;
33906         this_ptr_conv.inner = untag_ptr(this_ptr);
33907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33909         this_ptr_conv.is_owned = false;
33910         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
33911         return ret_conv;
33912 }
33913
33914 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) {
33915         LDKChannelDetails this_ptr_conv;
33916         this_ptr_conv.inner = untag_ptr(this_ptr);
33917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33919         this_ptr_conv.is_owned = false;
33920         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
33921 }
33922
33923 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) {
33924         LDKChannelDetails this_ptr_conv;
33925         this_ptr_conv.inner = untag_ptr(this_ptr);
33926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33928         this_ptr_conv.is_owned = false;
33929         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
33930         return ret_conv;
33931 }
33932
33933 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) {
33934         LDKChannelDetails this_ptr_conv;
33935         this_ptr_conv.inner = untag_ptr(this_ptr);
33936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33938         this_ptr_conv.is_owned = false;
33939         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
33940 }
33941
33942 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
33943         LDKChannelDetails this_ptr_conv;
33944         this_ptr_conv.inner = untag_ptr(this_ptr);
33945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33947         this_ptr_conv.is_owned = false;
33948         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
33949         return ret_conv;
33950 }
33951
33952 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
33953         LDKChannelDetails this_ptr_conv;
33954         this_ptr_conv.inner = untag_ptr(this_ptr);
33955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33957         this_ptr_conv.is_owned = false;
33958         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
33959 }
33960
33961 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
33962         LDKChannelDetails this_ptr_conv;
33963         this_ptr_conv.inner = untag_ptr(this_ptr);
33964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33966         this_ptr_conv.is_owned = false;
33967         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33968         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
33969         uint64_t ret_ref = tag_ptr(ret_copy, true);
33970         return ret_ref;
33971 }
33972
33973 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
33974         LDKChannelDetails this_ptr_conv;
33975         this_ptr_conv.inner = untag_ptr(this_ptr);
33976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33978         this_ptr_conv.is_owned = false;
33979         void* val_ptr = untag_ptr(val);
33980         CHECK_ACCESS(val_ptr);
33981         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33982         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
33983         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
33984 }
33985
33986 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
33987         LDKChannelDetails this_ptr_conv;
33988         this_ptr_conv.inner = untag_ptr(this_ptr);
33989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33991         this_ptr_conv.is_owned = false;
33992         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33993         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
33994         uint64_t ret_ref = tag_ptr(ret_copy, true);
33995         return ret_ref;
33996 }
33997
33998 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
33999         LDKChannelDetails this_ptr_conv;
34000         this_ptr_conv.inner = untag_ptr(this_ptr);
34001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34003         this_ptr_conv.is_owned = false;
34004         void* val_ptr = untag_ptr(val);
34005         CHECK_ACCESS(val_ptr);
34006         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34007         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34008         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
34009 }
34010
34011 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
34012         LDKChannelDetails this_ptr_conv;
34013         this_ptr_conv.inner = untag_ptr(this_ptr);
34014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34016         this_ptr_conv.is_owned = false;
34017         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
34018         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
34019         uint64_t ret_ref = tag_ptr(ret_copy, true);
34020         return ret_ref;
34021 }
34022
34023 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) {
34024         LDKChannelDetails this_ptr_conv;
34025         this_ptr_conv.inner = untag_ptr(this_ptr);
34026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34028         this_ptr_conv.is_owned = false;
34029         void* val_ptr = untag_ptr(val);
34030         CHECK_ACCESS(val_ptr);
34031         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
34032         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
34033         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
34034 }
34035
34036 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
34037         LDKChannelDetails this_ptr_conv;
34038         this_ptr_conv.inner = untag_ptr(this_ptr);
34039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34041         this_ptr_conv.is_owned = false;
34042         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
34043         return ret_conv;
34044 }
34045
34046 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
34047         LDKChannelDetails this_ptr_conv;
34048         this_ptr_conv.inner = untag_ptr(this_ptr);
34049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34051         this_ptr_conv.is_owned = false;
34052         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
34053 }
34054
34055 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
34056         LDKChannelDetails this_ptr_conv;
34057         this_ptr_conv.inner = untag_ptr(this_ptr);
34058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34060         this_ptr_conv.is_owned = false;
34061         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
34062         return ret_conv;
34063 }
34064
34065 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
34066         LDKChannelDetails this_ptr_conv;
34067         this_ptr_conv.inner = untag_ptr(this_ptr);
34068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34070         this_ptr_conv.is_owned = false;
34071         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
34072 }
34073
34074 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
34075         LDKChannelDetails this_ptr_conv;
34076         this_ptr_conv.inner = untag_ptr(this_ptr);
34077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34079         this_ptr_conv.is_owned = false;
34080         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
34081         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
34082         uint64_t ret_ref = tag_ptr(ret_copy, true);
34083         return ret_ref;
34084 }
34085
34086 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
34087         LDKChannelDetails this_ptr_conv;
34088         this_ptr_conv.inner = untag_ptr(this_ptr);
34089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34091         this_ptr_conv.is_owned = false;
34092         void* val_ptr = untag_ptr(val);
34093         CHECK_ACCESS(val_ptr);
34094         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
34095         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
34096         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
34097 }
34098
34099 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
34100         LDKChannelDetails this_ptr_conv;
34101         this_ptr_conv.inner = untag_ptr(this_ptr);
34102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34104         this_ptr_conv.is_owned = false;
34105         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
34106         return ret_conv;
34107 }
34108
34109 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
34110         LDKChannelDetails this_ptr_conv;
34111         this_ptr_conv.inner = untag_ptr(this_ptr);
34112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34114         this_ptr_conv.is_owned = false;
34115         ChannelDetails_set_is_usable(&this_ptr_conv, val);
34116 }
34117
34118 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
34119         LDKChannelDetails this_ptr_conv;
34120         this_ptr_conv.inner = untag_ptr(this_ptr);
34121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34123         this_ptr_conv.is_owned = false;
34124         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
34125         return ret_conv;
34126 }
34127
34128 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
34129         LDKChannelDetails this_ptr_conv;
34130         this_ptr_conv.inner = untag_ptr(this_ptr);
34131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34133         this_ptr_conv.is_owned = false;
34134         ChannelDetails_set_is_public(&this_ptr_conv, val);
34135 }
34136
34137 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
34138         LDKChannelDetails this_ptr_conv;
34139         this_ptr_conv.inner = untag_ptr(this_ptr);
34140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34142         this_ptr_conv.is_owned = false;
34143         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34144         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
34145         uint64_t ret_ref = tag_ptr(ret_copy, true);
34146         return ret_ref;
34147 }
34148
34149 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) {
34150         LDKChannelDetails this_ptr_conv;
34151         this_ptr_conv.inner = untag_ptr(this_ptr);
34152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34154         this_ptr_conv.is_owned = false;
34155         void* val_ptr = untag_ptr(val);
34156         CHECK_ACCESS(val_ptr);
34157         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34158         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34159         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
34160 }
34161
34162 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
34163         LDKChannelDetails this_ptr_conv;
34164         this_ptr_conv.inner = untag_ptr(this_ptr);
34165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34167         this_ptr_conv.is_owned = false;
34168         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34169         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
34170         uint64_t ret_ref = tag_ptr(ret_copy, true);
34171         return ret_ref;
34172 }
34173
34174 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) {
34175         LDKChannelDetails this_ptr_conv;
34176         this_ptr_conv.inner = untag_ptr(this_ptr);
34177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34179         this_ptr_conv.is_owned = false;
34180         void* val_ptr = untag_ptr(val);
34181         CHECK_ACCESS(val_ptr);
34182         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34183         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34184         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
34185 }
34186
34187 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
34188         LDKChannelDetails this_ptr_conv;
34189         this_ptr_conv.inner = untag_ptr(this_ptr);
34190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34192         this_ptr_conv.is_owned = false;
34193         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
34194         uint64_t ret_ref = 0;
34195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34197         return ret_ref;
34198 }
34199
34200 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
34201         LDKChannelDetails this_ptr_conv;
34202         this_ptr_conv.inner = untag_ptr(this_ptr);
34203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34205         this_ptr_conv.is_owned = false;
34206         LDKChannelConfig val_conv;
34207         val_conv.inner = untag_ptr(val);
34208         val_conv.is_owned = ptr_is_owned(val);
34209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34210         val_conv = ChannelConfig_clone(&val_conv);
34211         ChannelDetails_set_config(&this_ptr_conv, val_conv);
34212 }
34213
34214 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) {
34215         LDKThirtyTwoBytes channel_id_arg_ref;
34216         CHECK(channel_id_arg->arr_len == 32);
34217         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
34218         LDKChannelCounterparty counterparty_arg_conv;
34219         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
34220         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
34221         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
34222         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
34223         LDKOutPoint funding_txo_arg_conv;
34224         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
34225         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
34226         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
34227         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
34228         LDKChannelTypeFeatures channel_type_arg_conv;
34229         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
34230         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
34231         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
34232         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
34233         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
34234         CHECK_ACCESS(short_channel_id_arg_ptr);
34235         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
34236         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
34237         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
34238         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
34239         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
34240         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
34241         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
34242         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
34243         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
34244         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
34245         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
34246         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
34247         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
34248         LDKU128 user_channel_id_arg_ref;
34249         CHECK(user_channel_id_arg->arr_len == 16);
34250         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
34251         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
34252         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
34253         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
34254         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
34255         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
34256         CHECK_ACCESS(confirmations_required_arg_ptr);
34257         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
34258         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
34259         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
34260         CHECK_ACCESS(confirmations_arg_ptr);
34261         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
34262         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
34263         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
34264         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
34265         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
34266         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
34267         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
34268         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
34269         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
34270         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
34271         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
34272         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
34273         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
34274         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
34275         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
34276         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
34277         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
34278         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
34279         LDKChannelConfig config_arg_conv;
34280         config_arg_conv.inner = untag_ptr(config_arg);
34281         config_arg_conv.is_owned = ptr_is_owned(config_arg);
34282         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
34283         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
34284         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);
34285         uint64_t ret_ref = 0;
34286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34288         return ret_ref;
34289 }
34290
34291 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
34292         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
34293         uint64_t ret_ref = 0;
34294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34296         return ret_ref;
34297 }
34298 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
34299         LDKChannelDetails arg_conv;
34300         arg_conv.inner = untag_ptr(arg);
34301         arg_conv.is_owned = ptr_is_owned(arg);
34302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34303         arg_conv.is_owned = false;
34304         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
34305         return ret_conv;
34306 }
34307
34308 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
34309         LDKChannelDetails orig_conv;
34310         orig_conv.inner = untag_ptr(orig);
34311         orig_conv.is_owned = ptr_is_owned(orig);
34312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34313         orig_conv.is_owned = false;
34314         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
34315         uint64_t ret_ref = 0;
34316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34318         return ret_ref;
34319 }
34320
34321 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
34322         LDKChannelDetails this_arg_conv;
34323         this_arg_conv.inner = untag_ptr(this_arg);
34324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34326         this_arg_conv.is_owned = false;
34327         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34328         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
34329         uint64_t ret_ref = tag_ptr(ret_copy, true);
34330         return ret_ref;
34331 }
34332
34333 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
34334         LDKChannelDetails this_arg_conv;
34335         this_arg_conv.inner = untag_ptr(this_arg);
34336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34338         this_arg_conv.is_owned = false;
34339         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34340         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
34341         uint64_t ret_ref = tag_ptr(ret_copy, true);
34342         return ret_ref;
34343 }
34344
34345 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
34346         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
34347         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
34348         return ret_conv;
34349 }
34350
34351 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
34352         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
34353         return ret_conv;
34354 }
34355
34356 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
34357         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
34358         return ret_conv;
34359 }
34360
34361 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
34362         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
34363         return ret_conv;
34364 }
34365
34366 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
34367         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
34368         return ret_conv;
34369 }
34370
34371 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
34372         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
34373         return ret_conv;
34374 }
34375
34376 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
34377         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
34378         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
34379         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
34380         return ret_conv;
34381 }
34382
34383 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
34384         if (!ptr_is_owned(this_ptr)) return;
34385         void* this_ptr_ptr = untag_ptr(this_ptr);
34386         CHECK_ACCESS(this_ptr_ptr);
34387         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
34388         FREE(untag_ptr(this_ptr));
34389         RecentPaymentDetails_free(this_ptr_conv);
34390 }
34391
34392 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
34393         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34394         *ret_copy = RecentPaymentDetails_clone(arg);
34395         uint64_t ret_ref = tag_ptr(ret_copy, true);
34396         return ret_ref;
34397 }
34398 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
34399         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
34400         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
34401         return ret_conv;
34402 }
34403
34404 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
34405         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
34406         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34407         *ret_copy = RecentPaymentDetails_clone(orig_conv);
34408         uint64_t ret_ref = tag_ptr(ret_copy, true);
34409         return ret_ref;
34410 }
34411
34412 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
34413         LDKThirtyTwoBytes payment_id_ref;
34414         CHECK(payment_id->arr_len == 32);
34415         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34416         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34417         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
34418         uint64_t ret_ref = tag_ptr(ret_copy, true);
34419         return ret_ref;
34420 }
34421
34422 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
34423         LDKThirtyTwoBytes payment_id_ref;
34424         CHECK(payment_id->arr_len == 32);
34425         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34426         LDKThirtyTwoBytes payment_hash_ref;
34427         CHECK(payment_hash->arr_len == 32);
34428         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34429         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34430         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
34431         uint64_t ret_ref = tag_ptr(ret_copy, true);
34432         return ret_ref;
34433 }
34434
34435 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
34436         LDKThirtyTwoBytes payment_id_ref;
34437         CHECK(payment_id->arr_len == 32);
34438         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34439         void* payment_hash_ptr = untag_ptr(payment_hash);
34440         CHECK_ACCESS(payment_hash_ptr);
34441         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
34442         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
34443         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34444         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
34445         uint64_t ret_ref = tag_ptr(ret_copy, true);
34446         return ret_ref;
34447 }
34448
34449 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
34450         LDKThirtyTwoBytes payment_id_ref;
34451         CHECK(payment_id->arr_len == 32);
34452         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34453         LDKThirtyTwoBytes payment_hash_ref;
34454         CHECK(payment_hash->arr_len == 32);
34455         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34456         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34457         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
34458         uint64_t ret_ref = tag_ptr(ret_copy, true);
34459         return ret_ref;
34460 }
34461
34462 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
34463         LDKPhantomRouteHints this_obj_conv;
34464         this_obj_conv.inner = untag_ptr(this_obj);
34465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34467         PhantomRouteHints_free(this_obj_conv);
34468 }
34469
34470 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
34471         LDKPhantomRouteHints this_ptr_conv;
34472         this_ptr_conv.inner = untag_ptr(this_ptr);
34473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34475         this_ptr_conv.is_owned = false;
34476         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
34477         uint64_tArray ret_arr = NULL;
34478         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34479         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34480         for (size_t q = 0; q < ret_var.datalen; q++) {
34481                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
34482                 uint64_t ret_conv_16_ref = 0;
34483                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34484                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34485                 ret_arr_ptr[q] = ret_conv_16_ref;
34486         }
34487         
34488         FREE(ret_var.data);
34489         return ret_arr;
34490 }
34491
34492 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
34493         LDKPhantomRouteHints this_ptr_conv;
34494         this_ptr_conv.inner = untag_ptr(this_ptr);
34495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34497         this_ptr_conv.is_owned = false;
34498         LDKCVec_ChannelDetailsZ val_constr;
34499         val_constr.datalen = val->arr_len;
34500         if (val_constr.datalen > 0)
34501                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34502         else
34503                 val_constr.data = NULL;
34504         uint64_t* val_vals = val->elems;
34505         for (size_t q = 0; q < val_constr.datalen; q++) {
34506                 uint64_t val_conv_16 = val_vals[q];
34507                 LDKChannelDetails val_conv_16_conv;
34508                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
34509                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
34510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
34511                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
34512                 val_constr.data[q] = val_conv_16_conv;
34513         }
34514         FREE(val);
34515         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
34516 }
34517
34518 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
34519         LDKPhantomRouteHints this_ptr_conv;
34520         this_ptr_conv.inner = untag_ptr(this_ptr);
34521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34523         this_ptr_conv.is_owned = false;
34524         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
34525         return ret_conv;
34526 }
34527
34528 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
34529         LDKPhantomRouteHints this_ptr_conv;
34530         this_ptr_conv.inner = untag_ptr(this_ptr);
34531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34533         this_ptr_conv.is_owned = false;
34534         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
34535 }
34536
34537 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
34538         LDKPhantomRouteHints this_ptr_conv;
34539         this_ptr_conv.inner = untag_ptr(this_ptr);
34540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34542         this_ptr_conv.is_owned = false;
34543         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34544         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
34545         return ret_arr;
34546 }
34547
34548 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
34549         LDKPhantomRouteHints this_ptr_conv;
34550         this_ptr_conv.inner = untag_ptr(this_ptr);
34551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34553         this_ptr_conv.is_owned = false;
34554         LDKPublicKey val_ref;
34555         CHECK(val->arr_len == 33);
34556         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34557         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
34558 }
34559
34560 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) {
34561         LDKCVec_ChannelDetailsZ channels_arg_constr;
34562         channels_arg_constr.datalen = channels_arg->arr_len;
34563         if (channels_arg_constr.datalen > 0)
34564                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34565         else
34566                 channels_arg_constr.data = NULL;
34567         uint64_t* channels_arg_vals = channels_arg->elems;
34568         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
34569                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
34570                 LDKChannelDetails channels_arg_conv_16_conv;
34571                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
34572                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
34573                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
34574                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
34575                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
34576         }
34577         FREE(channels_arg);
34578         LDKPublicKey real_node_pubkey_arg_ref;
34579         CHECK(real_node_pubkey_arg->arr_len == 33);
34580         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
34581         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
34582         uint64_t ret_ref = 0;
34583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34585         return ret_ref;
34586 }
34587
34588 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
34589         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
34590         uint64_t ret_ref = 0;
34591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34593         return ret_ref;
34594 }
34595 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
34596         LDKPhantomRouteHints arg_conv;
34597         arg_conv.inner = untag_ptr(arg);
34598         arg_conv.is_owned = ptr_is_owned(arg);
34599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34600         arg_conv.is_owned = false;
34601         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
34602         return ret_conv;
34603 }
34604
34605 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
34606         LDKPhantomRouteHints orig_conv;
34607         orig_conv.inner = untag_ptr(orig);
34608         orig_conv.is_owned = ptr_is_owned(orig);
34609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34610         orig_conv.is_owned = false;
34611         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
34612         uint64_t ret_ref = 0;
34613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34615         return ret_ref;
34616 }
34617
34618 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) {
34619         void* fee_est_ptr = untag_ptr(fee_est);
34620         CHECK_ACCESS(fee_est_ptr);
34621         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
34622         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
34623                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34624                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
34625         }
34626         void* chain_monitor_ptr = untag_ptr(chain_monitor);
34627         CHECK_ACCESS(chain_monitor_ptr);
34628         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
34629         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
34630                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34631                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
34632         }
34633         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
34634         CHECK_ACCESS(tx_broadcaster_ptr);
34635         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
34636         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34637                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34638                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
34639         }
34640         void* router_ptr = untag_ptr(router);
34641         CHECK_ACCESS(router_ptr);
34642         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
34643         if (router_conv.free == LDKRouter_JCalls_free) {
34644                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34645                 LDKRouter_JCalls_cloned(&router_conv);
34646         }
34647         void* logger_ptr = untag_ptr(logger);
34648         CHECK_ACCESS(logger_ptr);
34649         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34650         if (logger_conv.free == LDKLogger_JCalls_free) {
34651                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34652                 LDKLogger_JCalls_cloned(&logger_conv);
34653         }
34654         void* entropy_source_ptr = untag_ptr(entropy_source);
34655         CHECK_ACCESS(entropy_source_ptr);
34656         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
34657         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
34658                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34659                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
34660         }
34661         void* node_signer_ptr = untag_ptr(node_signer);
34662         CHECK_ACCESS(node_signer_ptr);
34663         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
34664         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
34665                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34666                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
34667         }
34668         void* signer_provider_ptr = untag_ptr(signer_provider);
34669         CHECK_ACCESS(signer_provider_ptr);
34670         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34671         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34672                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34673                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34674         }
34675         LDKUserConfig config_conv;
34676         config_conv.inner = untag_ptr(config);
34677         config_conv.is_owned = ptr_is_owned(config);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
34679         config_conv = UserConfig_clone(&config_conv);
34680         LDKChainParameters params_conv;
34681         params_conv.inner = untag_ptr(params);
34682         params_conv.is_owned = ptr_is_owned(params);
34683         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34684         params_conv = ChainParameters_clone(&params_conv);
34685         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);
34686         uint64_t ret_ref = 0;
34687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34689         return ret_ref;
34690 }
34691
34692 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
34693         LDKChannelManager this_arg_conv;
34694         this_arg_conv.inner = untag_ptr(this_arg);
34695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34697         this_arg_conv.is_owned = false;
34698         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
34699         uint64_t ret_ref = 0;
34700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34702         return ret_ref;
34703 }
34704
34705 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) {
34706         LDKChannelManager this_arg_conv;
34707         this_arg_conv.inner = untag_ptr(this_arg);
34708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34710         this_arg_conv.is_owned = false;
34711         LDKPublicKey their_network_key_ref;
34712         CHECK(their_network_key->arr_len == 33);
34713         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
34714         LDKU128 user_channel_id_ref;
34715         CHECK(user_channel_id->arr_len == 16);
34716         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
34717         LDKUserConfig override_config_conv;
34718         override_config_conv.inner = untag_ptr(override_config);
34719         override_config_conv.is_owned = ptr_is_owned(override_config);
34720         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
34721         override_config_conv = UserConfig_clone(&override_config_conv);
34722         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
34723         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
34724         return tag_ptr(ret_conv, true);
34725 }
34726
34727 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
34728         LDKChannelManager this_arg_conv;
34729         this_arg_conv.inner = untag_ptr(this_arg);
34730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34732         this_arg_conv.is_owned = false;
34733         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
34734         uint64_tArray ret_arr = NULL;
34735         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34736         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34737         for (size_t q = 0; q < ret_var.datalen; q++) {
34738                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
34739                 uint64_t ret_conv_16_ref = 0;
34740                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34741                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34742                 ret_arr_ptr[q] = ret_conv_16_ref;
34743         }
34744         
34745         FREE(ret_var.data);
34746         return ret_arr;
34747 }
34748
34749 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
34750         LDKChannelManager this_arg_conv;
34751         this_arg_conv.inner = untag_ptr(this_arg);
34752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34754         this_arg_conv.is_owned = false;
34755         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
34756         uint64_tArray ret_arr = NULL;
34757         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34758         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34759         for (size_t q = 0; q < ret_var.datalen; q++) {
34760                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
34761                 uint64_t ret_conv_16_ref = 0;
34762                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34763                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34764                 ret_arr_ptr[q] = ret_conv_16_ref;
34765         }
34766         
34767         FREE(ret_var.data);
34768         return ret_arr;
34769 }
34770
34771 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) {
34772         LDKChannelManager this_arg_conv;
34773         this_arg_conv.inner = untag_ptr(this_arg);
34774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34776         this_arg_conv.is_owned = false;
34777         LDKPublicKey counterparty_node_id_ref;
34778         CHECK(counterparty_node_id->arr_len == 33);
34779         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34780         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
34781         uint64_tArray ret_arr = NULL;
34782         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34783         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34784         for (size_t q = 0; q < ret_var.datalen; q++) {
34785                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
34786                 uint64_t ret_conv_16_ref = 0;
34787                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34788                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34789                 ret_arr_ptr[q] = ret_conv_16_ref;
34790         }
34791         
34792         FREE(ret_var.data);
34793         return ret_arr;
34794 }
34795
34796 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
34797         LDKChannelManager this_arg_conv;
34798         this_arg_conv.inner = untag_ptr(this_arg);
34799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34801         this_arg_conv.is_owned = false;
34802         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
34803         uint64_tArray ret_arr = NULL;
34804         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34805         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34806         for (size_t w = 0; w < ret_var.datalen; w++) {
34807                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34808                 *ret_conv_22_copy = ret_var.data[w];
34809                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
34810                 ret_arr_ptr[w] = ret_conv_22_ref;
34811         }
34812         
34813         FREE(ret_var.data);
34814         return ret_arr;
34815 }
34816
34817 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) {
34818         LDKChannelManager this_arg_conv;
34819         this_arg_conv.inner = untag_ptr(this_arg);
34820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34822         this_arg_conv.is_owned = false;
34823         uint8_t channel_id_arr[32];
34824         CHECK(channel_id->arr_len == 32);
34825         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
34826         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
34827         LDKPublicKey counterparty_node_id_ref;
34828         CHECK(counterparty_node_id->arr_len == 33);
34829         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34830         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34831         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
34832         return tag_ptr(ret_conv, true);
34833 }
34834
34835 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) {
34836         LDKChannelManager this_arg_conv;
34837         this_arg_conv.inner = untag_ptr(this_arg);
34838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34840         this_arg_conv.is_owned = false;
34841         uint8_t channel_id_arr[32];
34842         CHECK(channel_id->arr_len == 32);
34843         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
34844         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
34845         LDKPublicKey counterparty_node_id_ref;
34846         CHECK(counterparty_node_id->arr_len == 33);
34847         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34848         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
34849         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
34850         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
34851         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
34852         LDKShutdownScript shutdown_script_conv;
34853         shutdown_script_conv.inner = untag_ptr(shutdown_script);
34854         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
34855         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
34856         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
34857         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34858         *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);
34859         return tag_ptr(ret_conv, true);
34860 }
34861
34862 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) {
34863         LDKChannelManager this_arg_conv;
34864         this_arg_conv.inner = untag_ptr(this_arg);
34865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34867         this_arg_conv.is_owned = false;
34868         uint8_t channel_id_arr[32];
34869         CHECK(channel_id->arr_len == 32);
34870         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
34871         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
34872         LDKPublicKey counterparty_node_id_ref;
34873         CHECK(counterparty_node_id->arr_len == 33);
34874         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34875         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34876         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
34877         return tag_ptr(ret_conv, true);
34878 }
34879
34880 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) {
34881         LDKChannelManager this_arg_conv;
34882         this_arg_conv.inner = untag_ptr(this_arg);
34883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34885         this_arg_conv.is_owned = false;
34886         uint8_t channel_id_arr[32];
34887         CHECK(channel_id->arr_len == 32);
34888         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
34889         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
34890         LDKPublicKey counterparty_node_id_ref;
34891         CHECK(counterparty_node_id->arr_len == 33);
34892         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34893         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34894         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
34895         return tag_ptr(ret_conv, true);
34896 }
34897
34898 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) {
34899         LDKChannelManager this_arg_conv;
34900         this_arg_conv.inner = untag_ptr(this_arg);
34901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34903         this_arg_conv.is_owned = false;
34904         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
34905 }
34906
34907 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) {
34908         LDKChannelManager this_arg_conv;
34909         this_arg_conv.inner = untag_ptr(this_arg);
34910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34912         this_arg_conv.is_owned = false;
34913         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
34914 }
34915
34916 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) {
34917         LDKChannelManager this_arg_conv;
34918         this_arg_conv.inner = untag_ptr(this_arg);
34919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34921         this_arg_conv.is_owned = false;
34922         LDKRoute route_conv;
34923         route_conv.inner = untag_ptr(route);
34924         route_conv.is_owned = ptr_is_owned(route);
34925         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
34926         route_conv.is_owned = false;
34927         LDKThirtyTwoBytes payment_hash_ref;
34928         CHECK(payment_hash->arr_len == 32);
34929         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34930         LDKRecipientOnionFields recipient_onion_conv;
34931         recipient_onion_conv.inner = untag_ptr(recipient_onion);
34932         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
34933         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
34934         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
34935         LDKThirtyTwoBytes payment_id_ref;
34936         CHECK(payment_id->arr_len == 32);
34937         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34938         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
34939         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
34940         return tag_ptr(ret_conv, true);
34941 }
34942
34943 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) {
34944         LDKChannelManager this_arg_conv;
34945         this_arg_conv.inner = untag_ptr(this_arg);
34946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34948         this_arg_conv.is_owned = false;
34949         LDKThirtyTwoBytes payment_hash_ref;
34950         CHECK(payment_hash->arr_len == 32);
34951         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34952         LDKRecipientOnionFields recipient_onion_conv;
34953         recipient_onion_conv.inner = untag_ptr(recipient_onion);
34954         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
34955         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
34956         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
34957         LDKThirtyTwoBytes payment_id_ref;
34958         CHECK(payment_id->arr_len == 32);
34959         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34960         LDKRouteParameters route_params_conv;
34961         route_params_conv.inner = untag_ptr(route_params);
34962         route_params_conv.is_owned = ptr_is_owned(route_params);
34963         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
34964         route_params_conv = RouteParameters_clone(&route_params_conv);
34965         void* retry_strategy_ptr = untag_ptr(retry_strategy);
34966         CHECK_ACCESS(retry_strategy_ptr);
34967         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
34968         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
34969         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
34970         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
34971         return tag_ptr(ret_conv, true);
34972 }
34973
34974 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
34975         LDKChannelManager this_arg_conv;
34976         this_arg_conv.inner = untag_ptr(this_arg);
34977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34979         this_arg_conv.is_owned = false;
34980         LDKThirtyTwoBytes payment_id_ref;
34981         CHECK(payment_id->arr_len == 32);
34982         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34983         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
34984 }
34985
34986 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) {
34987         LDKChannelManager this_arg_conv;
34988         this_arg_conv.inner = untag_ptr(this_arg);
34989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34991         this_arg_conv.is_owned = false;
34992         LDKRoute route_conv;
34993         route_conv.inner = untag_ptr(route);
34994         route_conv.is_owned = ptr_is_owned(route);
34995         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
34996         route_conv.is_owned = false;
34997         void* payment_preimage_ptr = untag_ptr(payment_preimage);
34998         CHECK_ACCESS(payment_preimage_ptr);
34999         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
35000         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
35001         LDKRecipientOnionFields recipient_onion_conv;
35002         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35003         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35004         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35005         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35006         LDKThirtyTwoBytes payment_id_ref;
35007         CHECK(payment_id->arr_len == 32);
35008         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35009         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
35010         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
35011         return tag_ptr(ret_conv, true);
35012 }
35013
35014 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) {
35015         LDKChannelManager this_arg_conv;
35016         this_arg_conv.inner = untag_ptr(this_arg);
35017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35019         this_arg_conv.is_owned = false;
35020         void* payment_preimage_ptr = untag_ptr(payment_preimage);
35021         CHECK_ACCESS(payment_preimage_ptr);
35022         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
35023         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
35024         LDKRecipientOnionFields recipient_onion_conv;
35025         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35026         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35027         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35028         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35029         LDKThirtyTwoBytes payment_id_ref;
35030         CHECK(payment_id->arr_len == 32);
35031         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35032         LDKRouteParameters route_params_conv;
35033         route_params_conv.inner = untag_ptr(route_params);
35034         route_params_conv.is_owned = ptr_is_owned(route_params);
35035         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35036         route_params_conv = RouteParameters_clone(&route_params_conv);
35037         void* retry_strategy_ptr = untag_ptr(retry_strategy);
35038         CHECK_ACCESS(retry_strategy_ptr);
35039         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
35040         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
35041         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
35042         *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);
35043         return tag_ptr(ret_conv, true);
35044 }
35045
35046 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
35047         LDKChannelManager this_arg_conv;
35048         this_arg_conv.inner = untag_ptr(this_arg);
35049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35051         this_arg_conv.is_owned = false;
35052         LDKPath path_conv;
35053         path_conv.inner = untag_ptr(path);
35054         path_conv.is_owned = ptr_is_owned(path);
35055         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
35056         path_conv = Path_clone(&path_conv);
35057         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
35058         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
35059         return tag_ptr(ret_conv, true);
35060 }
35061
35062 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_preflight_probes"))) TS_ChannelManager_send_spontaneous_preflight_probes(uint64_t this_arg, int8_tArray node_id, int64_t amount_msat, int32_t final_cltv_expiry_delta, uint64_t liquidity_limit_multiplier) {
35063         LDKChannelManager this_arg_conv;
35064         this_arg_conv.inner = untag_ptr(this_arg);
35065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35067         this_arg_conv.is_owned = false;
35068         LDKPublicKey node_id_ref;
35069         CHECK(node_id->arr_len == 33);
35070         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35071         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
35072         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
35073         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
35074         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
35075         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
35076         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
35077         return tag_ptr(ret_conv, true);
35078 }
35079
35080 uint64_t  __attribute__((export_name("TS_ChannelManager_send_preflight_probes"))) TS_ChannelManager_send_preflight_probes(uint64_t this_arg, uint64_t route_params, uint64_t liquidity_limit_multiplier) {
35081         LDKChannelManager this_arg_conv;
35082         this_arg_conv.inner = untag_ptr(this_arg);
35083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35085         this_arg_conv.is_owned = false;
35086         LDKRouteParameters route_params_conv;
35087         route_params_conv.inner = untag_ptr(route_params);
35088         route_params_conv.is_owned = ptr_is_owned(route_params);
35089         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35090         route_params_conv = RouteParameters_clone(&route_params_conv);
35091         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
35092         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
35093         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
35094         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
35095         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
35096         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
35097         return tag_ptr(ret_conv, true);
35098 }
35099
35100 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) {
35101         LDKChannelManager this_arg_conv;
35102         this_arg_conv.inner = untag_ptr(this_arg);
35103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35105         this_arg_conv.is_owned = false;
35106         uint8_t temporary_channel_id_arr[32];
35107         CHECK(temporary_channel_id->arr_len == 32);
35108         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35109         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35110         LDKPublicKey counterparty_node_id_ref;
35111         CHECK(counterparty_node_id->arr_len == 33);
35112         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35113         LDKTransaction funding_transaction_ref;
35114         funding_transaction_ref.datalen = funding_transaction->arr_len;
35115         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
35116         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
35117         funding_transaction_ref.data_is_owned = true;
35118         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35119         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
35120         return tag_ptr(ret_conv, true);
35121 }
35122
35123 uint64_t  __attribute__((export_name("TS_ChannelManager_batch_funding_transaction_generated"))) TS_ChannelManager_batch_funding_transaction_generated(uint64_t this_arg, uint64_tArray temporary_channels, int8_tArray funding_transaction) {
35124         LDKChannelManager this_arg_conv;
35125         this_arg_conv.inner = untag_ptr(this_arg);
35126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35128         this_arg_conv.is_owned = false;
35129         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
35130         temporary_channels_constr.datalen = temporary_channels->arr_len;
35131         if (temporary_channels_constr.datalen > 0)
35132                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
35133         else
35134                 temporary_channels_constr.data = NULL;
35135         uint64_t* temporary_channels_vals = temporary_channels->elems;
35136         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
35137                 uint64_t temporary_channels_conv_35 = temporary_channels_vals[j];
35138                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
35139                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
35140                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
35141                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
35142                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
35143         }
35144         FREE(temporary_channels);
35145         LDKTransaction funding_transaction_ref;
35146         funding_transaction_ref.datalen = funding_transaction->arr_len;
35147         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
35148         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
35149         funding_transaction_ref.data_is_owned = true;
35150         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35151         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
35152         return tag_ptr(ret_conv, true);
35153 }
35154
35155 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) {
35156         LDKChannelManager this_arg_conv;
35157         this_arg_conv.inner = untag_ptr(this_arg);
35158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35160         this_arg_conv.is_owned = false;
35161         LDKPublicKey counterparty_node_id_ref;
35162         CHECK(counterparty_node_id->arr_len == 33);
35163         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35164         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
35165         channel_ids_constr.datalen = channel_ids->arr_len;
35166         if (channel_ids_constr.datalen > 0)
35167                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
35168         else
35169                 channel_ids_constr.data = NULL;
35170         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
35171         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
35172                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
35173                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
35174                 CHECK(channel_ids_conv_12->arr_len == 32);
35175                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
35176                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
35177         }
35178         FREE(channel_ids);
35179         LDKChannelConfigUpdate config_update_conv;
35180         config_update_conv.inner = untag_ptr(config_update);
35181         config_update_conv.is_owned = ptr_is_owned(config_update);
35182         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
35183         config_update_conv.is_owned = false;
35184         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35185         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
35186         return tag_ptr(ret_conv, true);
35187 }
35188
35189 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) {
35190         LDKChannelManager this_arg_conv;
35191         this_arg_conv.inner = untag_ptr(this_arg);
35192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35194         this_arg_conv.is_owned = false;
35195         LDKPublicKey counterparty_node_id_ref;
35196         CHECK(counterparty_node_id->arr_len == 33);
35197         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35198         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
35199         channel_ids_constr.datalen = channel_ids->arr_len;
35200         if (channel_ids_constr.datalen > 0)
35201                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
35202         else
35203                 channel_ids_constr.data = NULL;
35204         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
35205         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
35206                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
35207                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
35208                 CHECK(channel_ids_conv_12->arr_len == 32);
35209                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
35210                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
35211         }
35212         FREE(channel_ids);
35213         LDKChannelConfig config_conv;
35214         config_conv.inner = untag_ptr(config);
35215         config_conv.is_owned = ptr_is_owned(config);
35216         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
35217         config_conv.is_owned = false;
35218         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35219         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
35220         return tag_ptr(ret_conv, true);
35221 }
35222
35223 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) {
35224         LDKChannelManager this_arg_conv;
35225         this_arg_conv.inner = untag_ptr(this_arg);
35226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35228         this_arg_conv.is_owned = false;
35229         LDKThirtyTwoBytes intercept_id_ref;
35230         CHECK(intercept_id->arr_len == 32);
35231         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
35232         uint8_t next_hop_channel_id_arr[32];
35233         CHECK(next_hop_channel_id->arr_len == 32);
35234         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
35235         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
35236         LDKPublicKey next_node_id_ref;
35237         CHECK(next_node_id->arr_len == 33);
35238         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
35239         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35240         *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);
35241         return tag_ptr(ret_conv, true);
35242 }
35243
35244 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
35245         LDKChannelManager this_arg_conv;
35246         this_arg_conv.inner = untag_ptr(this_arg);
35247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35249         this_arg_conv.is_owned = false;
35250         LDKThirtyTwoBytes intercept_id_ref;
35251         CHECK(intercept_id->arr_len == 32);
35252         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
35253         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35254         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
35255         return tag_ptr(ret_conv, true);
35256 }
35257
35258 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
35259         LDKChannelManager this_arg_conv;
35260         this_arg_conv.inner = untag_ptr(this_arg);
35261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35263         this_arg_conv.is_owned = false;
35264         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
35265 }
35266
35267 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
35268         LDKChannelManager this_arg_conv;
35269         this_arg_conv.inner = untag_ptr(this_arg);
35270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35272         this_arg_conv.is_owned = false;
35273         ChannelManager_timer_tick_occurred(&this_arg_conv);
35274 }
35275
35276 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
35277         LDKChannelManager this_arg_conv;
35278         this_arg_conv.inner = untag_ptr(this_arg);
35279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35281         this_arg_conv.is_owned = false;
35282         uint8_t payment_hash_arr[32];
35283         CHECK(payment_hash->arr_len == 32);
35284         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
35285         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
35286         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
35287 }
35288
35289 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards_with_reason"))) TS_ChannelManager_fail_htlc_backwards_with_reason(uint64_t this_arg, int8_tArray payment_hash, uint64_t failure_code) {
35290         LDKChannelManager this_arg_conv;
35291         this_arg_conv.inner = untag_ptr(this_arg);
35292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35294         this_arg_conv.is_owned = false;
35295         uint8_t payment_hash_arr[32];
35296         CHECK(payment_hash->arr_len == 32);
35297         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
35298         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
35299         void* failure_code_ptr = untag_ptr(failure_code);
35300         CHECK_ACCESS(failure_code_ptr);
35301         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
35302         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
35303         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
35304 }
35305
35306 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
35307         LDKChannelManager this_arg_conv;
35308         this_arg_conv.inner = untag_ptr(this_arg);
35309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35311         this_arg_conv.is_owned = false;
35312         LDKThirtyTwoBytes payment_preimage_ref;
35313         CHECK(payment_preimage->arr_len == 32);
35314         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35315         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
35316 }
35317
35318 void  __attribute__((export_name("TS_ChannelManager_claim_funds_with_known_custom_tlvs"))) TS_ChannelManager_claim_funds_with_known_custom_tlvs(uint64_t this_arg, int8_tArray payment_preimage) {
35319         LDKChannelManager this_arg_conv;
35320         this_arg_conv.inner = untag_ptr(this_arg);
35321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35323         this_arg_conv.is_owned = false;
35324         LDKThirtyTwoBytes payment_preimage_ref;
35325         CHECK(payment_preimage->arr_len == 32);
35326         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35327         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
35328 }
35329
35330 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
35331         LDKChannelManager this_arg_conv;
35332         this_arg_conv.inner = untag_ptr(this_arg);
35333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35335         this_arg_conv.is_owned = false;
35336         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35337         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
35338         return ret_arr;
35339 }
35340
35341 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) {
35342         LDKChannelManager this_arg_conv;
35343         this_arg_conv.inner = untag_ptr(this_arg);
35344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35346         this_arg_conv.is_owned = false;
35347         uint8_t temporary_channel_id_arr[32];
35348         CHECK(temporary_channel_id->arr_len == 32);
35349         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35350         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35351         LDKPublicKey counterparty_node_id_ref;
35352         CHECK(counterparty_node_id->arr_len == 33);
35353         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35354         LDKU128 user_channel_id_ref;
35355         CHECK(user_channel_id->arr_len == 16);
35356         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35357         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35358         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
35359         return tag_ptr(ret_conv, true);
35360 }
35361
35362 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) {
35363         LDKChannelManager this_arg_conv;
35364         this_arg_conv.inner = untag_ptr(this_arg);
35365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35367         this_arg_conv.is_owned = false;
35368         uint8_t temporary_channel_id_arr[32];
35369         CHECK(temporary_channel_id->arr_len == 32);
35370         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35371         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35372         LDKPublicKey counterparty_node_id_ref;
35373         CHECK(counterparty_node_id->arr_len == 33);
35374         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35375         LDKU128 user_channel_id_ref;
35376         CHECK(user_channel_id->arr_len == 16);
35377         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35378         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35379         *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);
35380         return tag_ptr(ret_conv, true);
35381 }
35382
35383 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) {
35384         LDKChannelManager this_arg_conv;
35385         this_arg_conv.inner = untag_ptr(this_arg);
35386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35388         this_arg_conv.is_owned = false;
35389         void* min_value_msat_ptr = untag_ptr(min_value_msat);
35390         CHECK_ACCESS(min_value_msat_ptr);
35391         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
35392         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
35393         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
35394         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
35395         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
35396         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
35397         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
35398         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
35399         return tag_ptr(ret_conv, true);
35400 }
35401
35402 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) {
35403         LDKChannelManager this_arg_conv;
35404         this_arg_conv.inner = untag_ptr(this_arg);
35405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35407         this_arg_conv.is_owned = false;
35408         LDKThirtyTwoBytes payment_hash_ref;
35409         CHECK(payment_hash->arr_len == 32);
35410         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35411         void* min_value_msat_ptr = untag_ptr(min_value_msat);
35412         CHECK_ACCESS(min_value_msat_ptr);
35413         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
35414         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
35415         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
35416         CHECK_ACCESS(min_final_cltv_expiry_ptr);
35417         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
35418         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
35419         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
35420         *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);
35421         return tag_ptr(ret_conv, true);
35422 }
35423
35424 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) {
35425         LDKChannelManager this_arg_conv;
35426         this_arg_conv.inner = untag_ptr(this_arg);
35427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35429         this_arg_conv.is_owned = false;
35430         LDKThirtyTwoBytes payment_hash_ref;
35431         CHECK(payment_hash->arr_len == 32);
35432         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35433         LDKThirtyTwoBytes payment_secret_ref;
35434         CHECK(payment_secret->arr_len == 32);
35435         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
35436         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
35437         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
35438         return tag_ptr(ret_conv, true);
35439 }
35440
35441 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
35442         LDKChannelManager this_arg_conv;
35443         this_arg_conv.inner = untag_ptr(this_arg);
35444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35446         this_arg_conv.is_owned = false;
35447         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
35448         return ret_conv;
35449 }
35450
35451 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
35452         LDKChannelManager this_arg_conv;
35453         this_arg_conv.inner = untag_ptr(this_arg);
35454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35456         this_arg_conv.is_owned = false;
35457         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
35458         uint64_t ret_ref = 0;
35459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35461         return ret_ref;
35462 }
35463
35464 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
35465         LDKChannelManager this_arg_conv;
35466         this_arg_conv.inner = untag_ptr(this_arg);
35467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35469         this_arg_conv.is_owned = false;
35470         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
35471         return ret_conv;
35472 }
35473
35474 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
35475         LDKChannelManager this_arg_conv;
35476         this_arg_conv.inner = untag_ptr(this_arg);
35477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35479         this_arg_conv.is_owned = false;
35480         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
35481         uint64_t ret_ref = 0;
35482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35484         return ret_ref;
35485 }
35486
35487 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
35488         LDKChannelManager this_arg_conv;
35489         this_arg_conv.inner = untag_ptr(this_arg);
35490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35492         this_arg_conv.is_owned = false;
35493         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35494         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
35495         return tag_ptr(ret_ret, true);
35496 }
35497
35498 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
35499         LDKChannelManager this_arg_conv;
35500         this_arg_conv.inner = untag_ptr(this_arg);
35501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35503         this_arg_conv.is_owned = false;
35504         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
35505         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
35506         return tag_ptr(ret_ret, true);
35507 }
35508
35509 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
35510         LDKChannelManager this_arg_conv;
35511         this_arg_conv.inner = untag_ptr(this_arg);
35512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35514         this_arg_conv.is_owned = false;
35515         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
35516         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
35517         return tag_ptr(ret_ret, true);
35518 }
35519
35520 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
35521         LDKChannelManager this_arg_conv;
35522         this_arg_conv.inner = untag_ptr(this_arg);
35523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35525         this_arg_conv.is_owned = false;
35526         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
35527         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
35528         return tag_ptr(ret_ret, true);
35529 }
35530
35531 uint64_t  __attribute__((export_name("TS_ChannelManager_get_event_or_persistence_needed_future"))) TS_ChannelManager_get_event_or_persistence_needed_future(uint64_t this_arg) {
35532         LDKChannelManager this_arg_conv;
35533         this_arg_conv.inner = untag_ptr(this_arg);
35534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35536         this_arg_conv.is_owned = false;
35537         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
35538         uint64_t ret_ref = 0;
35539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35541         return ret_ref;
35542 }
35543
35544 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
35545         LDKChannelManager this_arg_conv;
35546         this_arg_conv.inner = untag_ptr(this_arg);
35547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35549         this_arg_conv.is_owned = false;
35550         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
35551         return ret_conv;
35552 }
35553
35554 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
35555         LDKChannelManager this_arg_conv;
35556         this_arg_conv.inner = untag_ptr(this_arg);
35557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35559         this_arg_conv.is_owned = false;
35560         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
35561         uint64_t ret_ref = 0;
35562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35564         return ret_ref;
35565 }
35566
35567 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
35568         LDKChannelManager this_arg_conv;
35569         this_arg_conv.inner = untag_ptr(this_arg);
35570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35572         this_arg_conv.is_owned = false;
35573         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
35574         uint64_t ret_ref = 0;
35575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35577         return ret_ref;
35578 }
35579
35580 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
35581         LDKChannelManager this_arg_conv;
35582         this_arg_conv.inner = untag_ptr(this_arg);
35583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35585         this_arg_conv.is_owned = false;
35586         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
35587         uint64_t ret_ref = 0;
35588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35590         return ret_ref;
35591 }
35592
35593 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
35594         LDKChannelManager this_arg_conv;
35595         this_arg_conv.inner = untag_ptr(this_arg);
35596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35598         this_arg_conv.is_owned = false;
35599         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
35600         uint64_t ret_ref = 0;
35601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35603         return ret_ref;
35604 }
35605
35606 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
35607         LDKChannelManager this_arg_conv;
35608         this_arg_conv.inner = untag_ptr(this_arg);
35609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35611         this_arg_conv.is_owned = false;
35612         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
35613         uint64_t ret_ref = 0;
35614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35616         return ret_ref;
35617 }
35618
35619 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
35620         LDKChannelManager this_arg_conv;
35621         this_arg_conv.inner = untag_ptr(this_arg);
35622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35624         this_arg_conv.is_owned = false;
35625         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
35626         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
35627         return tag_ptr(ret_ret, true);
35628 }
35629
35630 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
35631         LDKUserConfig config_conv;
35632         config_conv.inner = untag_ptr(config);
35633         config_conv.is_owned = ptr_is_owned(config);
35634         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
35635         config_conv.is_owned = false;
35636         LDKInitFeatures ret_var = provided_init_features(&config_conv);
35637         uint64_t ret_ref = 0;
35638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35640         return ret_ref;
35641 }
35642
35643 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
35644         LDKCounterpartyForwardingInfo obj_conv;
35645         obj_conv.inner = untag_ptr(obj);
35646         obj_conv.is_owned = ptr_is_owned(obj);
35647         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35648         obj_conv.is_owned = false;
35649         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
35650         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35651         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35652         CVec_u8Z_free(ret_var);
35653         return ret_arr;
35654 }
35655
35656 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
35657         LDKu8slice ser_ref;
35658         ser_ref.datalen = ser->arr_len;
35659         ser_ref.data = ser->elems;
35660         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
35661         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
35662         FREE(ser);
35663         return tag_ptr(ret_conv, true);
35664 }
35665
35666 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
35667         LDKChannelCounterparty obj_conv;
35668         obj_conv.inner = untag_ptr(obj);
35669         obj_conv.is_owned = ptr_is_owned(obj);
35670         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35671         obj_conv.is_owned = false;
35672         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
35673         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35674         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35675         CVec_u8Z_free(ret_var);
35676         return ret_arr;
35677 }
35678
35679 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
35680         LDKu8slice ser_ref;
35681         ser_ref.datalen = ser->arr_len;
35682         ser_ref.data = ser->elems;
35683         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
35684         *ret_conv = ChannelCounterparty_read(ser_ref);
35685         FREE(ser);
35686         return tag_ptr(ret_conv, true);
35687 }
35688
35689 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
35690         LDKChannelDetails obj_conv;
35691         obj_conv.inner = untag_ptr(obj);
35692         obj_conv.is_owned = ptr_is_owned(obj);
35693         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35694         obj_conv.is_owned = false;
35695         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
35696         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35697         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35698         CVec_u8Z_free(ret_var);
35699         return ret_arr;
35700 }
35701
35702 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
35703         LDKu8slice ser_ref;
35704         ser_ref.datalen = ser->arr_len;
35705         ser_ref.data = ser->elems;
35706         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
35707         *ret_conv = ChannelDetails_read(ser_ref);
35708         FREE(ser);
35709         return tag_ptr(ret_conv, true);
35710 }
35711
35712 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
35713         LDKPhantomRouteHints obj_conv;
35714         obj_conv.inner = untag_ptr(obj);
35715         obj_conv.is_owned = ptr_is_owned(obj);
35716         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35717         obj_conv.is_owned = false;
35718         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
35719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35721         CVec_u8Z_free(ret_var);
35722         return ret_arr;
35723 }
35724
35725 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
35726         LDKu8slice ser_ref;
35727         ser_ref.datalen = ser->arr_len;
35728         ser_ref.data = ser->elems;
35729         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
35730         *ret_conv = PhantomRouteHints_read(ser_ref);
35731         FREE(ser);
35732         return tag_ptr(ret_conv, true);
35733 }
35734
35735 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
35736         LDKChannelManager obj_conv;
35737         obj_conv.inner = untag_ptr(obj);
35738         obj_conv.is_owned = ptr_is_owned(obj);
35739         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35740         obj_conv.is_owned = false;
35741         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
35742         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35743         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35744         CVec_u8Z_free(ret_var);
35745         return ret_arr;
35746 }
35747
35748 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
35749         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
35750         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
35751         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35752         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35753         CVec_u8Z_free(ret_var);
35754         return ret_arr;
35755 }
35756
35757 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
35758         LDKu8slice ser_ref;
35759         ser_ref.datalen = ser->arr_len;
35760         ser_ref.data = ser->elems;
35761         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
35762         *ret_conv = ChannelShutdownState_read(ser_ref);
35763         FREE(ser);
35764         return tag_ptr(ret_conv, true);
35765 }
35766
35767 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
35768         LDKChannelManagerReadArgs this_obj_conv;
35769         this_obj_conv.inner = untag_ptr(this_obj);
35770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35772         ChannelManagerReadArgs_free(this_obj_conv);
35773 }
35774
35775 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
35776         LDKChannelManagerReadArgs this_ptr_conv;
35777         this_ptr_conv.inner = untag_ptr(this_ptr);
35778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35780         this_ptr_conv.is_owned = false;
35781         // WARNING: This object doesn't live past this scope, needs clone!
35782         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
35783         return ret_ret;
35784 }
35785
35786 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
35787         LDKChannelManagerReadArgs this_ptr_conv;
35788         this_ptr_conv.inner = untag_ptr(this_ptr);
35789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35791         this_ptr_conv.is_owned = false;
35792         void* val_ptr = untag_ptr(val);
35793         CHECK_ACCESS(val_ptr);
35794         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
35795         if (val_conv.free == LDKEntropySource_JCalls_free) {
35796                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35797                 LDKEntropySource_JCalls_cloned(&val_conv);
35798         }
35799         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
35800 }
35801
35802 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
35803         LDKChannelManagerReadArgs this_ptr_conv;
35804         this_ptr_conv.inner = untag_ptr(this_ptr);
35805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35807         this_ptr_conv.is_owned = false;
35808         // WARNING: This object doesn't live past this scope, needs clone!
35809         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
35810         return ret_ret;
35811 }
35812
35813 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
35814         LDKChannelManagerReadArgs this_ptr_conv;
35815         this_ptr_conv.inner = untag_ptr(this_ptr);
35816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35818         this_ptr_conv.is_owned = false;
35819         void* val_ptr = untag_ptr(val);
35820         CHECK_ACCESS(val_ptr);
35821         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
35822         if (val_conv.free == LDKNodeSigner_JCalls_free) {
35823                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35824                 LDKNodeSigner_JCalls_cloned(&val_conv);
35825         }
35826         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
35827 }
35828
35829 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
35830         LDKChannelManagerReadArgs this_ptr_conv;
35831         this_ptr_conv.inner = untag_ptr(this_ptr);
35832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35834         this_ptr_conv.is_owned = false;
35835         // WARNING: This object doesn't live past this scope, needs clone!
35836         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
35837         return ret_ret;
35838 }
35839
35840 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
35841         LDKChannelManagerReadArgs this_ptr_conv;
35842         this_ptr_conv.inner = untag_ptr(this_ptr);
35843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35845         this_ptr_conv.is_owned = false;
35846         void* val_ptr = untag_ptr(val);
35847         CHECK_ACCESS(val_ptr);
35848         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
35849         if (val_conv.free == LDKSignerProvider_JCalls_free) {
35850                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35851                 LDKSignerProvider_JCalls_cloned(&val_conv);
35852         }
35853         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
35854 }
35855
35856 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
35857         LDKChannelManagerReadArgs this_ptr_conv;
35858         this_ptr_conv.inner = untag_ptr(this_ptr);
35859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35861         this_ptr_conv.is_owned = false;
35862         // WARNING: This object doesn't live past this scope, needs clone!
35863         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
35864         return ret_ret;
35865 }
35866
35867 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
35868         LDKChannelManagerReadArgs this_ptr_conv;
35869         this_ptr_conv.inner = untag_ptr(this_ptr);
35870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35872         this_ptr_conv.is_owned = false;
35873         void* val_ptr = untag_ptr(val);
35874         CHECK_ACCESS(val_ptr);
35875         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
35876         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
35877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35878                 LDKFeeEstimator_JCalls_cloned(&val_conv);
35879         }
35880         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
35881 }
35882
35883 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
35884         LDKChannelManagerReadArgs this_ptr_conv;
35885         this_ptr_conv.inner = untag_ptr(this_ptr);
35886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35888         this_ptr_conv.is_owned = false;
35889         // WARNING: This object doesn't live past this scope, needs clone!
35890         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
35891         return ret_ret;
35892 }
35893
35894 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
35895         LDKChannelManagerReadArgs this_ptr_conv;
35896         this_ptr_conv.inner = untag_ptr(this_ptr);
35897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35899         this_ptr_conv.is_owned = false;
35900         void* val_ptr = untag_ptr(val);
35901         CHECK_ACCESS(val_ptr);
35902         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
35903         if (val_conv.free == LDKWatch_JCalls_free) {
35904                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35905                 LDKWatch_JCalls_cloned(&val_conv);
35906         }
35907         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
35908 }
35909
35910 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
35911         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
35917         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
35918         return ret_ret;
35919 }
35920
35921 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
35922         LDKChannelManagerReadArgs this_ptr_conv;
35923         this_ptr_conv.inner = untag_ptr(this_ptr);
35924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35926         this_ptr_conv.is_owned = false;
35927         void* val_ptr = untag_ptr(val);
35928         CHECK_ACCESS(val_ptr);
35929         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
35930         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
35931                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35932                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
35933         }
35934         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
35935 }
35936
35937 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
35938         LDKChannelManagerReadArgs this_ptr_conv;
35939         this_ptr_conv.inner = untag_ptr(this_ptr);
35940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35942         this_ptr_conv.is_owned = false;
35943         // WARNING: This object doesn't live past this scope, needs clone!
35944         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
35945         return ret_ret;
35946 }
35947
35948 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
35949         LDKChannelManagerReadArgs 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         void* val_ptr = untag_ptr(val);
35955         CHECK_ACCESS(val_ptr);
35956         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
35957         if (val_conv.free == LDKRouter_JCalls_free) {
35958                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35959                 LDKRouter_JCalls_cloned(&val_conv);
35960         }
35961         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
35962 }
35963
35964 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
35965         LDKChannelManagerReadArgs this_ptr_conv;
35966         this_ptr_conv.inner = untag_ptr(this_ptr);
35967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35969         this_ptr_conv.is_owned = false;
35970         // WARNING: This object doesn't live past this scope, needs clone!
35971         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
35972         return ret_ret;
35973 }
35974
35975 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
35976         LDKChannelManagerReadArgs this_ptr_conv;
35977         this_ptr_conv.inner = untag_ptr(this_ptr);
35978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35980         this_ptr_conv.is_owned = false;
35981         void* val_ptr = untag_ptr(val);
35982         CHECK_ACCESS(val_ptr);
35983         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
35984         if (val_conv.free == LDKLogger_JCalls_free) {
35985                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35986                 LDKLogger_JCalls_cloned(&val_conv);
35987         }
35988         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
35989 }
35990
35991 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
35992         LDKChannelManagerReadArgs this_ptr_conv;
35993         this_ptr_conv.inner = untag_ptr(this_ptr);
35994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35996         this_ptr_conv.is_owned = false;
35997         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
35998         uint64_t ret_ref = 0;
35999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36001         return ret_ref;
36002 }
36003
36004 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
36005         LDKChannelManagerReadArgs this_ptr_conv;
36006         this_ptr_conv.inner = untag_ptr(this_ptr);
36007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36009         this_ptr_conv.is_owned = false;
36010         LDKUserConfig val_conv;
36011         val_conv.inner = untag_ptr(val);
36012         val_conv.is_owned = ptr_is_owned(val);
36013         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36014         val_conv = UserConfig_clone(&val_conv);
36015         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
36016 }
36017
36018 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) {
36019         void* entropy_source_ptr = untag_ptr(entropy_source);
36020         CHECK_ACCESS(entropy_source_ptr);
36021         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
36022         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
36023                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36024                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
36025         }
36026         void* node_signer_ptr = untag_ptr(node_signer);
36027         CHECK_ACCESS(node_signer_ptr);
36028         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
36029         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
36030                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36031                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
36032         }
36033         void* signer_provider_ptr = untag_ptr(signer_provider);
36034         CHECK_ACCESS(signer_provider_ptr);
36035         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
36036         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
36037                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36038                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
36039         }
36040         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36041         CHECK_ACCESS(fee_estimator_ptr);
36042         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36043         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36044                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36045                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36046         }
36047         void* chain_monitor_ptr = untag_ptr(chain_monitor);
36048         CHECK_ACCESS(chain_monitor_ptr);
36049         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
36050         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
36051                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36052                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
36053         }
36054         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
36055         CHECK_ACCESS(tx_broadcaster_ptr);
36056         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
36057         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36058                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36059                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
36060         }
36061         void* router_ptr = untag_ptr(router);
36062         CHECK_ACCESS(router_ptr);
36063         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
36064         if (router_conv.free == LDKRouter_JCalls_free) {
36065                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36066                 LDKRouter_JCalls_cloned(&router_conv);
36067         }
36068         void* logger_ptr = untag_ptr(logger);
36069         CHECK_ACCESS(logger_ptr);
36070         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36071         if (logger_conv.free == LDKLogger_JCalls_free) {
36072                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36073                 LDKLogger_JCalls_cloned(&logger_conv);
36074         }
36075         LDKUserConfig default_config_conv;
36076         default_config_conv.inner = untag_ptr(default_config);
36077         default_config_conv.is_owned = ptr_is_owned(default_config);
36078         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
36079         default_config_conv = UserConfig_clone(&default_config_conv);
36080         LDKCVec_ChannelMonitorZ channel_monitors_constr;
36081         channel_monitors_constr.datalen = channel_monitors->arr_len;
36082         if (channel_monitors_constr.datalen > 0)
36083                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
36084         else
36085                 channel_monitors_constr.data = NULL;
36086         uint64_t* channel_monitors_vals = channel_monitors->elems;
36087         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
36088                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
36089                 LDKChannelMonitor channel_monitors_conv_16_conv;
36090                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
36091                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
36092                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
36093                 channel_monitors_conv_16_conv.is_owned = false;
36094                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
36095         }
36096         FREE(channel_monitors);
36097         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);
36098         uint64_t ret_ref = 0;
36099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36101         return ret_ref;
36102 }
36103
36104 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
36105         LDKu8slice ser_ref;
36106         ser_ref.datalen = ser->arr_len;
36107         ser_ref.data = ser->elems;
36108         LDKChannelManagerReadArgs arg_conv;
36109         arg_conv.inner = untag_ptr(arg);
36110         arg_conv.is_owned = ptr_is_owned(arg);
36111         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36112         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
36113         
36114         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
36115         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
36116         FREE(ser);
36117         return tag_ptr(ret_conv, true);
36118 }
36119
36120 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
36121         LDKExpandedKey this_obj_conv;
36122         this_obj_conv.inner = untag_ptr(this_obj);
36123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36125         ExpandedKey_free(this_obj_conv);
36126 }
36127
36128 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
36129         uint8_t key_material_arr[32];
36130         CHECK(key_material->arr_len == 32);
36131         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
36132         uint8_t (*key_material_ref)[32] = &key_material_arr;
36133         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
36134         uint64_t ret_ref = 0;
36135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36137         return ret_ref;
36138 }
36139
36140 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) {
36141         LDKExpandedKey keys_conv;
36142         keys_conv.inner = untag_ptr(keys);
36143         keys_conv.is_owned = ptr_is_owned(keys);
36144         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36145         keys_conv.is_owned = false;
36146         void* min_value_msat_ptr = untag_ptr(min_value_msat);
36147         CHECK_ACCESS(min_value_msat_ptr);
36148         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
36149         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
36150         void* entropy_source_ptr = untag_ptr(entropy_source);
36151         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
36152         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
36153         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
36154         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
36155         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
36156         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
36157         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
36158         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
36159         return tag_ptr(ret_conv, true);
36160 }
36161
36162 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) {
36163         LDKExpandedKey keys_conv;
36164         keys_conv.inner = untag_ptr(keys);
36165         keys_conv.is_owned = ptr_is_owned(keys);
36166         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36167         keys_conv.is_owned = false;
36168         void* min_value_msat_ptr = untag_ptr(min_value_msat);
36169         CHECK_ACCESS(min_value_msat_ptr);
36170         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
36171         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
36172         LDKThirtyTwoBytes payment_hash_ref;
36173         CHECK(payment_hash->arr_len == 32);
36174         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
36175         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
36176         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
36177         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
36178         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
36179         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
36180         *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);
36181         return tag_ptr(ret_conv, true);
36182 }
36183
36184 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
36185         if (!ptr_is_owned(this_ptr)) return;
36186         void* this_ptr_ptr = untag_ptr(this_ptr);
36187         CHECK_ACCESS(this_ptr_ptr);
36188         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
36189         FREE(untag_ptr(this_ptr));
36190         DecodeError_free(this_ptr_conv);
36191 }
36192
36193 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
36194         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36195         *ret_copy = DecodeError_clone(arg);
36196         uint64_t ret_ref = tag_ptr(ret_copy, true);
36197         return ret_ref;
36198 }
36199 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
36200         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
36201         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
36202         return ret_conv;
36203 }
36204
36205 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
36206         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
36207         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36208         *ret_copy = DecodeError_clone(orig_conv);
36209         uint64_t ret_ref = tag_ptr(ret_copy, true);
36210         return ret_ref;
36211 }
36212
36213 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
36214         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36215         *ret_copy = DecodeError_unknown_version();
36216         uint64_t ret_ref = tag_ptr(ret_copy, true);
36217         return ret_ref;
36218 }
36219
36220 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
36221         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36222         *ret_copy = DecodeError_unknown_required_feature();
36223         uint64_t ret_ref = tag_ptr(ret_copy, true);
36224         return ret_ref;
36225 }
36226
36227 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
36228         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36229         *ret_copy = DecodeError_invalid_value();
36230         uint64_t ret_ref = tag_ptr(ret_copy, true);
36231         return ret_ref;
36232 }
36233
36234 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
36235         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36236         *ret_copy = DecodeError_short_read();
36237         uint64_t ret_ref = tag_ptr(ret_copy, true);
36238         return ret_ref;
36239 }
36240
36241 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
36242         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36243         *ret_copy = DecodeError_bad_length_descriptor();
36244         uint64_t ret_ref = tag_ptr(ret_copy, true);
36245         return ret_ref;
36246 }
36247
36248 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
36249         LDKIOError a_conv = LDKIOError_from_js(a);
36250         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36251         *ret_copy = DecodeError_io(a_conv);
36252         uint64_t ret_ref = tag_ptr(ret_copy, true);
36253         return ret_ref;
36254 }
36255
36256 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
36257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36258         *ret_copy = DecodeError_unsupported_compression();
36259         uint64_t ret_ref = tag_ptr(ret_copy, true);
36260         return ret_ref;
36261 }
36262
36263 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
36264         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
36265         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
36266         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
36267         return ret_conv;
36268 }
36269
36270 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
36271         LDKInit this_obj_conv;
36272         this_obj_conv.inner = untag_ptr(this_obj);
36273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36275         Init_free(this_obj_conv);
36276 }
36277
36278 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
36279         LDKInit this_ptr_conv;
36280         this_ptr_conv.inner = untag_ptr(this_ptr);
36281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36283         this_ptr_conv.is_owned = false;
36284         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
36285         uint64_t ret_ref = 0;
36286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36288         return ret_ref;
36289 }
36290
36291 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
36292         LDKInit this_ptr_conv;
36293         this_ptr_conv.inner = untag_ptr(this_ptr);
36294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36296         this_ptr_conv.is_owned = false;
36297         LDKInitFeatures val_conv;
36298         val_conv.inner = untag_ptr(val);
36299         val_conv.is_owned = ptr_is_owned(val);
36300         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36301         val_conv = InitFeatures_clone(&val_conv);
36302         Init_set_features(&this_ptr_conv, val_conv);
36303 }
36304
36305 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
36306         LDKInit this_ptr_conv;
36307         this_ptr_conv.inner = untag_ptr(this_ptr);
36308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36310         this_ptr_conv.is_owned = false;
36311         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
36312         *ret_copy = Init_get_networks(&this_ptr_conv);
36313         uint64_t ret_ref = tag_ptr(ret_copy, true);
36314         return ret_ref;
36315 }
36316
36317 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
36318         LDKInit this_ptr_conv;
36319         this_ptr_conv.inner = untag_ptr(this_ptr);
36320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36322         this_ptr_conv.is_owned = false;
36323         void* val_ptr = untag_ptr(val);
36324         CHECK_ACCESS(val_ptr);
36325         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
36326         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
36327         Init_set_networks(&this_ptr_conv, val_conv);
36328 }
36329
36330 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
36331         LDKInit this_ptr_conv;
36332         this_ptr_conv.inner = untag_ptr(this_ptr);
36333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36335         this_ptr_conv.is_owned = false;
36336         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
36337         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
36338         uint64_t ret_ref = tag_ptr(ret_copy, true);
36339         return ret_ref;
36340 }
36341
36342 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
36343         LDKInit this_ptr_conv;
36344         this_ptr_conv.inner = untag_ptr(this_ptr);
36345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36347         this_ptr_conv.is_owned = false;
36348         void* val_ptr = untag_ptr(val);
36349         CHECK_ACCESS(val_ptr);
36350         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
36351         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
36352         Init_set_remote_network_address(&this_ptr_conv, val_conv);
36353 }
36354
36355 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) {
36356         LDKInitFeatures features_arg_conv;
36357         features_arg_conv.inner = untag_ptr(features_arg);
36358         features_arg_conv.is_owned = ptr_is_owned(features_arg);
36359         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36360         features_arg_conv = InitFeatures_clone(&features_arg_conv);
36361         void* networks_arg_ptr = untag_ptr(networks_arg);
36362         CHECK_ACCESS(networks_arg_ptr);
36363         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
36364         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
36365         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
36366         CHECK_ACCESS(remote_network_address_arg_ptr);
36367         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
36368         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
36369         uint64_t ret_ref = 0;
36370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36372         return ret_ref;
36373 }
36374
36375 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
36376         LDKInit ret_var = Init_clone(arg);
36377         uint64_t ret_ref = 0;
36378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36380         return ret_ref;
36381 }
36382 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
36383         LDKInit arg_conv;
36384         arg_conv.inner = untag_ptr(arg);
36385         arg_conv.is_owned = ptr_is_owned(arg);
36386         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36387         arg_conv.is_owned = false;
36388         int64_t ret_conv = Init_clone_ptr(&arg_conv);
36389         return ret_conv;
36390 }
36391
36392 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
36393         LDKInit orig_conv;
36394         orig_conv.inner = untag_ptr(orig);
36395         orig_conv.is_owned = ptr_is_owned(orig);
36396         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36397         orig_conv.is_owned = false;
36398         LDKInit ret_var = Init_clone(&orig_conv);
36399         uint64_t ret_ref = 0;
36400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36402         return ret_ref;
36403 }
36404
36405 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
36406         LDKInit a_conv;
36407         a_conv.inner = untag_ptr(a);
36408         a_conv.is_owned = ptr_is_owned(a);
36409         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36410         a_conv.is_owned = false;
36411         LDKInit b_conv;
36412         b_conv.inner = untag_ptr(b);
36413         b_conv.is_owned = ptr_is_owned(b);
36414         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36415         b_conv.is_owned = false;
36416         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
36417         return ret_conv;
36418 }
36419
36420 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
36421         LDKErrorMessage this_obj_conv;
36422         this_obj_conv.inner = untag_ptr(this_obj);
36423         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36425         ErrorMessage_free(this_obj_conv);
36426 }
36427
36428 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
36429         LDKErrorMessage this_ptr_conv;
36430         this_ptr_conv.inner = untag_ptr(this_ptr);
36431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36433         this_ptr_conv.is_owned = false;
36434         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36435         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
36436         return ret_arr;
36437 }
36438
36439 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
36440         LDKErrorMessage this_ptr_conv;
36441         this_ptr_conv.inner = untag_ptr(this_ptr);
36442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36444         this_ptr_conv.is_owned = false;
36445         LDKThirtyTwoBytes val_ref;
36446         CHECK(val->arr_len == 32);
36447         memcpy(val_ref.data, val->elems, 32); FREE(val);
36448         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
36449 }
36450
36451 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
36452         LDKErrorMessage this_ptr_conv;
36453         this_ptr_conv.inner = untag_ptr(this_ptr);
36454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36456         this_ptr_conv.is_owned = false;
36457         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
36458         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36459         Str_free(ret_str);
36460         return ret_conv;
36461 }
36462
36463 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
36464         LDKErrorMessage this_ptr_conv;
36465         this_ptr_conv.inner = untag_ptr(this_ptr);
36466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36468         this_ptr_conv.is_owned = false;
36469         LDKStr val_conv = str_ref_to_owned_c(val);
36470         ErrorMessage_set_data(&this_ptr_conv, val_conv);
36471 }
36472
36473 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
36474         LDKThirtyTwoBytes channel_id_arg_ref;
36475         CHECK(channel_id_arg->arr_len == 32);
36476         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
36477         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
36478         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
36479         uint64_t ret_ref = 0;
36480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36482         return ret_ref;
36483 }
36484
36485 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
36486         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
36487         uint64_t ret_ref = 0;
36488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36490         return ret_ref;
36491 }
36492 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
36493         LDKErrorMessage arg_conv;
36494         arg_conv.inner = untag_ptr(arg);
36495         arg_conv.is_owned = ptr_is_owned(arg);
36496         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36497         arg_conv.is_owned = false;
36498         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
36499         return ret_conv;
36500 }
36501
36502 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
36503         LDKErrorMessage orig_conv;
36504         orig_conv.inner = untag_ptr(orig);
36505         orig_conv.is_owned = ptr_is_owned(orig);
36506         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36507         orig_conv.is_owned = false;
36508         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
36509         uint64_t ret_ref = 0;
36510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36512         return ret_ref;
36513 }
36514
36515 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
36516         LDKErrorMessage a_conv;
36517         a_conv.inner = untag_ptr(a);
36518         a_conv.is_owned = ptr_is_owned(a);
36519         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36520         a_conv.is_owned = false;
36521         LDKErrorMessage b_conv;
36522         b_conv.inner = untag_ptr(b);
36523         b_conv.is_owned = ptr_is_owned(b);
36524         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36525         b_conv.is_owned = false;
36526         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
36527         return ret_conv;
36528 }
36529
36530 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
36531         LDKWarningMessage this_obj_conv;
36532         this_obj_conv.inner = untag_ptr(this_obj);
36533         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36535         WarningMessage_free(this_obj_conv);
36536 }
36537
36538 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
36539         LDKWarningMessage this_ptr_conv;
36540         this_ptr_conv.inner = untag_ptr(this_ptr);
36541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36543         this_ptr_conv.is_owned = false;
36544         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36545         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
36546         return ret_arr;
36547 }
36548
36549 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
36550         LDKWarningMessage 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         LDKThirtyTwoBytes val_ref;
36556         CHECK(val->arr_len == 32);
36557         memcpy(val_ref.data, val->elems, 32); FREE(val);
36558         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
36559 }
36560
36561 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
36562         LDKWarningMessage this_ptr_conv;
36563         this_ptr_conv.inner = untag_ptr(this_ptr);
36564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36566         this_ptr_conv.is_owned = false;
36567         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
36568         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36569         Str_free(ret_str);
36570         return ret_conv;
36571 }
36572
36573 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
36574         LDKWarningMessage this_ptr_conv;
36575         this_ptr_conv.inner = untag_ptr(this_ptr);
36576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36578         this_ptr_conv.is_owned = false;
36579         LDKStr val_conv = str_ref_to_owned_c(val);
36580         WarningMessage_set_data(&this_ptr_conv, val_conv);
36581 }
36582
36583 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
36584         LDKThirtyTwoBytes channel_id_arg_ref;
36585         CHECK(channel_id_arg->arr_len == 32);
36586         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
36587         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
36588         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
36589         uint64_t ret_ref = 0;
36590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36592         return ret_ref;
36593 }
36594
36595 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
36596         LDKWarningMessage ret_var = WarningMessage_clone(arg);
36597         uint64_t ret_ref = 0;
36598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36600         return ret_ref;
36601 }
36602 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
36603         LDKWarningMessage arg_conv;
36604         arg_conv.inner = untag_ptr(arg);
36605         arg_conv.is_owned = ptr_is_owned(arg);
36606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36607         arg_conv.is_owned = false;
36608         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
36609         return ret_conv;
36610 }
36611
36612 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
36613         LDKWarningMessage orig_conv;
36614         orig_conv.inner = untag_ptr(orig);
36615         orig_conv.is_owned = ptr_is_owned(orig);
36616         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36617         orig_conv.is_owned = false;
36618         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
36619         uint64_t ret_ref = 0;
36620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36622         return ret_ref;
36623 }
36624
36625 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
36626         LDKWarningMessage a_conv;
36627         a_conv.inner = untag_ptr(a);
36628         a_conv.is_owned = ptr_is_owned(a);
36629         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36630         a_conv.is_owned = false;
36631         LDKWarningMessage b_conv;
36632         b_conv.inner = untag_ptr(b);
36633         b_conv.is_owned = ptr_is_owned(b);
36634         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36635         b_conv.is_owned = false;
36636         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
36637         return ret_conv;
36638 }
36639
36640 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
36641         LDKPing this_obj_conv;
36642         this_obj_conv.inner = untag_ptr(this_obj);
36643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36645         Ping_free(this_obj_conv);
36646 }
36647
36648 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
36649         LDKPing this_ptr_conv;
36650         this_ptr_conv.inner = untag_ptr(this_ptr);
36651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36653         this_ptr_conv.is_owned = false;
36654         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
36655         return ret_conv;
36656 }
36657
36658 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
36659         LDKPing this_ptr_conv;
36660         this_ptr_conv.inner = untag_ptr(this_ptr);
36661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36663         this_ptr_conv.is_owned = false;
36664         Ping_set_ponglen(&this_ptr_conv, val);
36665 }
36666
36667 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
36668         LDKPing this_ptr_conv;
36669         this_ptr_conv.inner = untag_ptr(this_ptr);
36670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36672         this_ptr_conv.is_owned = false;
36673         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
36674         return ret_conv;
36675 }
36676
36677 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
36678         LDKPing this_ptr_conv;
36679         this_ptr_conv.inner = untag_ptr(this_ptr);
36680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36682         this_ptr_conv.is_owned = false;
36683         Ping_set_byteslen(&this_ptr_conv, val);
36684 }
36685
36686 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
36687         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
36688         uint64_t ret_ref = 0;
36689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36691         return ret_ref;
36692 }
36693
36694 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
36695         LDKPing ret_var = Ping_clone(arg);
36696         uint64_t ret_ref = 0;
36697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36699         return ret_ref;
36700 }
36701 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
36702         LDKPing arg_conv;
36703         arg_conv.inner = untag_ptr(arg);
36704         arg_conv.is_owned = ptr_is_owned(arg);
36705         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36706         arg_conv.is_owned = false;
36707         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
36708         return ret_conv;
36709 }
36710
36711 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
36712         LDKPing orig_conv;
36713         orig_conv.inner = untag_ptr(orig);
36714         orig_conv.is_owned = ptr_is_owned(orig);
36715         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36716         orig_conv.is_owned = false;
36717         LDKPing ret_var = Ping_clone(&orig_conv);
36718         uint64_t ret_ref = 0;
36719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36721         return ret_ref;
36722 }
36723
36724 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
36725         LDKPing a_conv;
36726         a_conv.inner = untag_ptr(a);
36727         a_conv.is_owned = ptr_is_owned(a);
36728         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36729         a_conv.is_owned = false;
36730         LDKPing b_conv;
36731         b_conv.inner = untag_ptr(b);
36732         b_conv.is_owned = ptr_is_owned(b);
36733         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36734         b_conv.is_owned = false;
36735         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
36736         return ret_conv;
36737 }
36738
36739 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
36740         LDKPong this_obj_conv;
36741         this_obj_conv.inner = untag_ptr(this_obj);
36742         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36744         Pong_free(this_obj_conv);
36745 }
36746
36747 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
36748         LDKPong this_ptr_conv;
36749         this_ptr_conv.inner = untag_ptr(this_ptr);
36750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36752         this_ptr_conv.is_owned = false;
36753         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
36754         return ret_conv;
36755 }
36756
36757 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
36758         LDKPong this_ptr_conv;
36759         this_ptr_conv.inner = untag_ptr(this_ptr);
36760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36762         this_ptr_conv.is_owned = false;
36763         Pong_set_byteslen(&this_ptr_conv, val);
36764 }
36765
36766 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
36767         LDKPong ret_var = Pong_new(byteslen_arg);
36768         uint64_t ret_ref = 0;
36769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36771         return ret_ref;
36772 }
36773
36774 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
36775         LDKPong ret_var = Pong_clone(arg);
36776         uint64_t ret_ref = 0;
36777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36779         return ret_ref;
36780 }
36781 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
36782         LDKPong arg_conv;
36783         arg_conv.inner = untag_ptr(arg);
36784         arg_conv.is_owned = ptr_is_owned(arg);
36785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36786         arg_conv.is_owned = false;
36787         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
36788         return ret_conv;
36789 }
36790
36791 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
36792         LDKPong orig_conv;
36793         orig_conv.inner = untag_ptr(orig);
36794         orig_conv.is_owned = ptr_is_owned(orig);
36795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36796         orig_conv.is_owned = false;
36797         LDKPong ret_var = Pong_clone(&orig_conv);
36798         uint64_t ret_ref = 0;
36799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36801         return ret_ref;
36802 }
36803
36804 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
36805         LDKPong a_conv;
36806         a_conv.inner = untag_ptr(a);
36807         a_conv.is_owned = ptr_is_owned(a);
36808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36809         a_conv.is_owned = false;
36810         LDKPong b_conv;
36811         b_conv.inner = untag_ptr(b);
36812         b_conv.is_owned = ptr_is_owned(b);
36813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36814         b_conv.is_owned = false;
36815         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
36816         return ret_conv;
36817 }
36818
36819 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
36820         LDKOpenChannel this_obj_conv;
36821         this_obj_conv.inner = untag_ptr(this_obj);
36822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36824         OpenChannel_free(this_obj_conv);
36825 }
36826
36827 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
36828         LDKOpenChannel this_ptr_conv;
36829         this_ptr_conv.inner = untag_ptr(this_ptr);
36830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36832         this_ptr_conv.is_owned = false;
36833         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36834         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
36835         return ret_arr;
36836 }
36837
36838 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
36839         LDKOpenChannel this_ptr_conv;
36840         this_ptr_conv.inner = untag_ptr(this_ptr);
36841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36843         this_ptr_conv.is_owned = false;
36844         LDKThirtyTwoBytes val_ref;
36845         CHECK(val->arr_len == 32);
36846         memcpy(val_ref.data, val->elems, 32); FREE(val);
36847         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
36848 }
36849
36850 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
36851         LDKOpenChannel this_ptr_conv;
36852         this_ptr_conv.inner = untag_ptr(this_ptr);
36853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36855         this_ptr_conv.is_owned = false;
36856         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36857         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
36858         return ret_arr;
36859 }
36860
36861 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
36862         LDKOpenChannel this_ptr_conv;
36863         this_ptr_conv.inner = untag_ptr(this_ptr);
36864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36866         this_ptr_conv.is_owned = false;
36867         LDKThirtyTwoBytes val_ref;
36868         CHECK(val->arr_len == 32);
36869         memcpy(val_ref.data, val->elems, 32); FREE(val);
36870         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
36871 }
36872
36873 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
36874         LDKOpenChannel 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         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
36880         return ret_conv;
36881 }
36882
36883 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
36884         LDKOpenChannel this_ptr_conv;
36885         this_ptr_conv.inner = untag_ptr(this_ptr);
36886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36888         this_ptr_conv.is_owned = false;
36889         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
36890 }
36891
36892 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
36893         LDKOpenChannel this_ptr_conv;
36894         this_ptr_conv.inner = untag_ptr(this_ptr);
36895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36897         this_ptr_conv.is_owned = false;
36898         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
36899         return ret_conv;
36900 }
36901
36902 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
36903         LDKOpenChannel this_ptr_conv;
36904         this_ptr_conv.inner = untag_ptr(this_ptr);
36905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36907         this_ptr_conv.is_owned = false;
36908         OpenChannel_set_push_msat(&this_ptr_conv, val);
36909 }
36910
36911 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
36912         LDKOpenChannel this_ptr_conv;
36913         this_ptr_conv.inner = untag_ptr(this_ptr);
36914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36916         this_ptr_conv.is_owned = false;
36917         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
36918         return ret_conv;
36919 }
36920
36921 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
36922         LDKOpenChannel this_ptr_conv;
36923         this_ptr_conv.inner = untag_ptr(this_ptr);
36924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36926         this_ptr_conv.is_owned = false;
36927         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
36928 }
36929
36930 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) {
36931         LDKOpenChannel this_ptr_conv;
36932         this_ptr_conv.inner = untag_ptr(this_ptr);
36933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36935         this_ptr_conv.is_owned = false;
36936         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
36937         return ret_conv;
36938 }
36939
36940 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) {
36941         LDKOpenChannel this_ptr_conv;
36942         this_ptr_conv.inner = untag_ptr(this_ptr);
36943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36945         this_ptr_conv.is_owned = false;
36946         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
36947 }
36948
36949 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
36950         LDKOpenChannel this_ptr_conv;
36951         this_ptr_conv.inner = untag_ptr(this_ptr);
36952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36954         this_ptr_conv.is_owned = false;
36955         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
36956         return ret_conv;
36957 }
36958
36959 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
36960         LDKOpenChannel this_ptr_conv;
36961         this_ptr_conv.inner = untag_ptr(this_ptr);
36962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36964         this_ptr_conv.is_owned = false;
36965         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
36966 }
36967
36968 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
36969         LDKOpenChannel this_ptr_conv;
36970         this_ptr_conv.inner = untag_ptr(this_ptr);
36971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36973         this_ptr_conv.is_owned = false;
36974         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
36975         return ret_conv;
36976 }
36977
36978 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
36979         LDKOpenChannel this_ptr_conv;
36980         this_ptr_conv.inner = untag_ptr(this_ptr);
36981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36983         this_ptr_conv.is_owned = false;
36984         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
36985 }
36986
36987 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
36988         LDKOpenChannel this_ptr_conv;
36989         this_ptr_conv.inner = untag_ptr(this_ptr);
36990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36992         this_ptr_conv.is_owned = false;
36993         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
36994         return ret_conv;
36995 }
36996
36997 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
36998         LDKOpenChannel this_ptr_conv;
36999         this_ptr_conv.inner = untag_ptr(this_ptr);
37000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37002         this_ptr_conv.is_owned = false;
37003         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
37004 }
37005
37006 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
37007         LDKOpenChannel this_ptr_conv;
37008         this_ptr_conv.inner = untag_ptr(this_ptr);
37009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37011         this_ptr_conv.is_owned = false;
37012         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
37013         return ret_conv;
37014 }
37015
37016 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
37017         LDKOpenChannel this_ptr_conv;
37018         this_ptr_conv.inner = untag_ptr(this_ptr);
37019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37021         this_ptr_conv.is_owned = false;
37022         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
37023 }
37024
37025 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
37026         LDKOpenChannel this_ptr_conv;
37027         this_ptr_conv.inner = untag_ptr(this_ptr);
37028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37030         this_ptr_conv.is_owned = false;
37031         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
37032         return ret_conv;
37033 }
37034
37035 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
37036         LDKOpenChannel this_ptr_conv;
37037         this_ptr_conv.inner = untag_ptr(this_ptr);
37038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37040         this_ptr_conv.is_owned = false;
37041         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
37042 }
37043
37044 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
37045         LDKOpenChannel this_ptr_conv;
37046         this_ptr_conv.inner = untag_ptr(this_ptr);
37047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37049         this_ptr_conv.is_owned = false;
37050         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37051         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
37052         return ret_arr;
37053 }
37054
37055 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
37056         LDKOpenChannel this_ptr_conv;
37057         this_ptr_conv.inner = untag_ptr(this_ptr);
37058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37060         this_ptr_conv.is_owned = false;
37061         LDKPublicKey val_ref;
37062         CHECK(val->arr_len == 33);
37063         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37064         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
37065 }
37066
37067 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
37068         LDKOpenChannel this_ptr_conv;
37069         this_ptr_conv.inner = untag_ptr(this_ptr);
37070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37072         this_ptr_conv.is_owned = false;
37073         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37074         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
37075         return ret_arr;
37076 }
37077
37078 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
37079         LDKOpenChannel this_ptr_conv;
37080         this_ptr_conv.inner = untag_ptr(this_ptr);
37081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37083         this_ptr_conv.is_owned = false;
37084         LDKPublicKey val_ref;
37085         CHECK(val->arr_len == 33);
37086         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37087         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
37088 }
37089
37090 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
37091         LDKOpenChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37097         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
37098         return ret_arr;
37099 }
37100
37101 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
37102         LDKOpenChannel this_ptr_conv;
37103         this_ptr_conv.inner = untag_ptr(this_ptr);
37104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37106         this_ptr_conv.is_owned = false;
37107         LDKPublicKey val_ref;
37108         CHECK(val->arr_len == 33);
37109         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37110         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
37111 }
37112
37113 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
37114         LDKOpenChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37120         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37121         return ret_arr;
37122 }
37123
37124 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37125         LDKOpenChannel this_ptr_conv;
37126         this_ptr_conv.inner = untag_ptr(this_ptr);
37127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37129         this_ptr_conv.is_owned = false;
37130         LDKPublicKey val_ref;
37131         CHECK(val->arr_len == 33);
37132         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37133         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37134 }
37135
37136 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
37137         LDKOpenChannel this_ptr_conv;
37138         this_ptr_conv.inner = untag_ptr(this_ptr);
37139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37141         this_ptr_conv.is_owned = false;
37142         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37143         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
37144         return ret_arr;
37145 }
37146
37147 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
37148         LDKOpenChannel this_ptr_conv;
37149         this_ptr_conv.inner = untag_ptr(this_ptr);
37150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37152         this_ptr_conv.is_owned = false;
37153         LDKPublicKey val_ref;
37154         CHECK(val->arr_len == 33);
37155         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37156         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
37157 }
37158
37159 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
37160         LDKOpenChannel this_ptr_conv;
37161         this_ptr_conv.inner = untag_ptr(this_ptr);
37162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37164         this_ptr_conv.is_owned = false;
37165         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37166         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37167         return ret_arr;
37168 }
37169
37170 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) {
37171         LDKOpenChannel this_ptr_conv;
37172         this_ptr_conv.inner = untag_ptr(this_ptr);
37173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37175         this_ptr_conv.is_owned = false;
37176         LDKPublicKey val_ref;
37177         CHECK(val->arr_len == 33);
37178         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37179         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
37180 }
37181
37182 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
37183         LDKOpenChannel this_ptr_conv;
37184         this_ptr_conv.inner = untag_ptr(this_ptr);
37185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37187         this_ptr_conv.is_owned = false;
37188         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
37189         return ret_conv;
37190 }
37191
37192 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
37193         LDKOpenChannel this_ptr_conv;
37194         this_ptr_conv.inner = untag_ptr(this_ptr);
37195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37197         this_ptr_conv.is_owned = false;
37198         OpenChannel_set_channel_flags(&this_ptr_conv, val);
37199 }
37200
37201 uint64_t  __attribute__((export_name("TS_OpenChannel_get_shutdown_scriptpubkey"))) TS_OpenChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
37202         LDKOpenChannel this_ptr_conv;
37203         this_ptr_conv.inner = untag_ptr(this_ptr);
37204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37206         this_ptr_conv.is_owned = false;
37207         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
37208         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
37209         uint64_t ret_ref = tag_ptr(ret_copy, true);
37210         return ret_ref;
37211 }
37212
37213 void  __attribute__((export_name("TS_OpenChannel_set_shutdown_scriptpubkey"))) TS_OpenChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
37214         LDKOpenChannel this_ptr_conv;
37215         this_ptr_conv.inner = untag_ptr(this_ptr);
37216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37218         this_ptr_conv.is_owned = false;
37219         void* val_ptr = untag_ptr(val);
37220         CHECK_ACCESS(val_ptr);
37221         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
37222         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
37223         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
37224 }
37225
37226 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
37227         LDKOpenChannel this_ptr_conv;
37228         this_ptr_conv.inner = untag_ptr(this_ptr);
37229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37231         this_ptr_conv.is_owned = false;
37232         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
37233         uint64_t ret_ref = 0;
37234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37236         return ret_ref;
37237 }
37238
37239 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
37240         LDKOpenChannel this_ptr_conv;
37241         this_ptr_conv.inner = untag_ptr(this_ptr);
37242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37244         this_ptr_conv.is_owned = false;
37245         LDKChannelTypeFeatures val_conv;
37246         val_conv.inner = untag_ptr(val);
37247         val_conv.is_owned = ptr_is_owned(val);
37248         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37249         val_conv = ChannelTypeFeatures_clone(&val_conv);
37250         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
37251 }
37252
37253 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) {
37254         LDKThirtyTwoBytes chain_hash_arg_ref;
37255         CHECK(chain_hash_arg->arr_len == 32);
37256         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
37257         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
37258         CHECK(temporary_channel_id_arg->arr_len == 32);
37259         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
37260         LDKPublicKey funding_pubkey_arg_ref;
37261         CHECK(funding_pubkey_arg->arr_len == 33);
37262         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
37263         LDKPublicKey revocation_basepoint_arg_ref;
37264         CHECK(revocation_basepoint_arg->arr_len == 33);
37265         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
37266         LDKPublicKey payment_point_arg_ref;
37267         CHECK(payment_point_arg->arr_len == 33);
37268         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
37269         LDKPublicKey delayed_payment_basepoint_arg_ref;
37270         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
37271         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
37272         LDKPublicKey htlc_basepoint_arg_ref;
37273         CHECK(htlc_basepoint_arg->arr_len == 33);
37274         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
37275         LDKPublicKey first_per_commitment_point_arg_ref;
37276         CHECK(first_per_commitment_point_arg->arr_len == 33);
37277         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
37278         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
37279         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
37280         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
37281         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
37282         LDKChannelTypeFeatures channel_type_arg_conv;
37283         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37284         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37285         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37286         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37287         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);
37288         uint64_t ret_ref = 0;
37289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37291         return ret_ref;
37292 }
37293
37294 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
37295         LDKOpenChannel ret_var = OpenChannel_clone(arg);
37296         uint64_t ret_ref = 0;
37297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37299         return ret_ref;
37300 }
37301 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
37302         LDKOpenChannel arg_conv;
37303         arg_conv.inner = untag_ptr(arg);
37304         arg_conv.is_owned = ptr_is_owned(arg);
37305         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37306         arg_conv.is_owned = false;
37307         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
37308         return ret_conv;
37309 }
37310
37311 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
37312         LDKOpenChannel orig_conv;
37313         orig_conv.inner = untag_ptr(orig);
37314         orig_conv.is_owned = ptr_is_owned(orig);
37315         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37316         orig_conv.is_owned = false;
37317         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
37318         uint64_t ret_ref = 0;
37319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37321         return ret_ref;
37322 }
37323
37324 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
37325         LDKOpenChannel a_conv;
37326         a_conv.inner = untag_ptr(a);
37327         a_conv.is_owned = ptr_is_owned(a);
37328         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37329         a_conv.is_owned = false;
37330         LDKOpenChannel b_conv;
37331         b_conv.inner = untag_ptr(b);
37332         b_conv.is_owned = ptr_is_owned(b);
37333         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37334         b_conv.is_owned = false;
37335         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
37336         return ret_conv;
37337 }
37338
37339 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
37340         LDKOpenChannelV2 this_obj_conv;
37341         this_obj_conv.inner = untag_ptr(this_obj);
37342         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37344         OpenChannelV2_free(this_obj_conv);
37345 }
37346
37347 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_chain_hash"))) TS_OpenChannelV2_get_chain_hash(uint64_t this_ptr) {
37348         LDKOpenChannelV2 this_ptr_conv;
37349         this_ptr_conv.inner = untag_ptr(this_ptr);
37350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37352         this_ptr_conv.is_owned = false;
37353         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37354         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
37355         return ret_arr;
37356 }
37357
37358 void  __attribute__((export_name("TS_OpenChannelV2_set_chain_hash"))) TS_OpenChannelV2_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
37359         LDKOpenChannelV2 this_ptr_conv;
37360         this_ptr_conv.inner = untag_ptr(this_ptr);
37361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37363         this_ptr_conv.is_owned = false;
37364         LDKThirtyTwoBytes val_ref;
37365         CHECK(val->arr_len == 32);
37366         memcpy(val_ref.data, val->elems, 32); FREE(val);
37367         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
37368 }
37369
37370 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_temporary_channel_id"))) TS_OpenChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
37371         LDKOpenChannelV2 this_ptr_conv;
37372         this_ptr_conv.inner = untag_ptr(this_ptr);
37373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37375         this_ptr_conv.is_owned = false;
37376         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37377         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
37378         return ret_arr;
37379 }
37380
37381 void  __attribute__((export_name("TS_OpenChannelV2_set_temporary_channel_id"))) TS_OpenChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
37382         LDKOpenChannelV2 this_ptr_conv;
37383         this_ptr_conv.inner = untag_ptr(this_ptr);
37384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37386         this_ptr_conv.is_owned = false;
37387         LDKThirtyTwoBytes val_ref;
37388         CHECK(val->arr_len == 32);
37389         memcpy(val_ref.data, val->elems, 32); FREE(val);
37390         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
37391 }
37392
37393 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) {
37394         LDKOpenChannelV2 this_ptr_conv;
37395         this_ptr_conv.inner = untag_ptr(this_ptr);
37396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37398         this_ptr_conv.is_owned = false;
37399         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
37400         return ret_conv;
37401 }
37402
37403 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) {
37404         LDKOpenChannelV2 this_ptr_conv;
37405         this_ptr_conv.inner = untag_ptr(this_ptr);
37406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37408         this_ptr_conv.is_owned = false;
37409         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
37410 }
37411
37412 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) {
37413         LDKOpenChannelV2 this_ptr_conv;
37414         this_ptr_conv.inner = untag_ptr(this_ptr);
37415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37417         this_ptr_conv.is_owned = false;
37418         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
37419         return ret_conv;
37420 }
37421
37422 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) {
37423         LDKOpenChannelV2 this_ptr_conv;
37424         this_ptr_conv.inner = untag_ptr(this_ptr);
37425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37427         this_ptr_conv.is_owned = false;
37428         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
37429 }
37430
37431 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_satoshis"))) TS_OpenChannelV2_get_funding_satoshis(uint64_t this_ptr) {
37432         LDKOpenChannelV2 this_ptr_conv;
37433         this_ptr_conv.inner = untag_ptr(this_ptr);
37434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37436         this_ptr_conv.is_owned = false;
37437         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
37438         return ret_conv;
37439 }
37440
37441 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_satoshis"))) TS_OpenChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
37442         LDKOpenChannelV2 this_ptr_conv;
37443         this_ptr_conv.inner = untag_ptr(this_ptr);
37444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37446         this_ptr_conv.is_owned = false;
37447         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
37448 }
37449
37450 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_dust_limit_satoshis"))) TS_OpenChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
37451         LDKOpenChannelV2 this_ptr_conv;
37452         this_ptr_conv.inner = untag_ptr(this_ptr);
37453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37455         this_ptr_conv.is_owned = false;
37456         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
37457         return ret_conv;
37458 }
37459
37460 void  __attribute__((export_name("TS_OpenChannelV2_set_dust_limit_satoshis"))) TS_OpenChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
37461         LDKOpenChannelV2 this_ptr_conv;
37462         this_ptr_conv.inner = untag_ptr(this_ptr);
37463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37465         this_ptr_conv.is_owned = false;
37466         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
37467 }
37468
37469 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) {
37470         LDKOpenChannelV2 this_ptr_conv;
37471         this_ptr_conv.inner = untag_ptr(this_ptr);
37472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37474         this_ptr_conv.is_owned = false;
37475         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
37476         return ret_conv;
37477 }
37478
37479 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) {
37480         LDKOpenChannelV2 this_ptr_conv;
37481         this_ptr_conv.inner = untag_ptr(this_ptr);
37482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37484         this_ptr_conv.is_owned = false;
37485         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37486 }
37487
37488 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_htlc_minimum_msat"))) TS_OpenChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
37489         LDKOpenChannelV2 this_ptr_conv;
37490         this_ptr_conv.inner = untag_ptr(this_ptr);
37491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37493         this_ptr_conv.is_owned = false;
37494         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
37495         return ret_conv;
37496 }
37497
37498 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_minimum_msat"))) TS_OpenChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
37499         LDKOpenChannelV2 this_ptr_conv;
37500         this_ptr_conv.inner = untag_ptr(this_ptr);
37501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37503         this_ptr_conv.is_owned = false;
37504         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
37505 }
37506
37507 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_to_self_delay"))) TS_OpenChannelV2_get_to_self_delay(uint64_t this_ptr) {
37508         LDKOpenChannelV2 this_ptr_conv;
37509         this_ptr_conv.inner = untag_ptr(this_ptr);
37510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37512         this_ptr_conv.is_owned = false;
37513         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
37514         return ret_conv;
37515 }
37516
37517 void  __attribute__((export_name("TS_OpenChannelV2_set_to_self_delay"))) TS_OpenChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
37518         LDKOpenChannelV2 this_ptr_conv;
37519         this_ptr_conv.inner = untag_ptr(this_ptr);
37520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37522         this_ptr_conv.is_owned = false;
37523         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
37524 }
37525
37526 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_max_accepted_htlcs"))) TS_OpenChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
37527         LDKOpenChannelV2 this_ptr_conv;
37528         this_ptr_conv.inner = untag_ptr(this_ptr);
37529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37531         this_ptr_conv.is_owned = false;
37532         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
37533         return ret_conv;
37534 }
37535
37536 void  __attribute__((export_name("TS_OpenChannelV2_set_max_accepted_htlcs"))) TS_OpenChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
37537         LDKOpenChannelV2 this_ptr_conv;
37538         this_ptr_conv.inner = untag_ptr(this_ptr);
37539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37541         this_ptr_conv.is_owned = false;
37542         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
37543 }
37544
37545 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
37546         LDKOpenChannelV2 this_ptr_conv;
37547         this_ptr_conv.inner = untag_ptr(this_ptr);
37548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37550         this_ptr_conv.is_owned = false;
37551         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
37552         return ret_conv;
37553 }
37554
37555 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
37556         LDKOpenChannelV2 this_ptr_conv;
37557         this_ptr_conv.inner = untag_ptr(this_ptr);
37558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37560         this_ptr_conv.is_owned = false;
37561         OpenChannelV2_set_locktime(&this_ptr_conv, val);
37562 }
37563
37564 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_funding_pubkey"))) TS_OpenChannelV2_get_funding_pubkey(uint64_t this_ptr) {
37565         LDKOpenChannelV2 this_ptr_conv;
37566         this_ptr_conv.inner = untag_ptr(this_ptr);
37567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37569         this_ptr_conv.is_owned = false;
37570         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37571         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
37572         return ret_arr;
37573 }
37574
37575 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_pubkey"))) TS_OpenChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
37576         LDKOpenChannelV2 this_ptr_conv;
37577         this_ptr_conv.inner = untag_ptr(this_ptr);
37578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37580         this_ptr_conv.is_owned = false;
37581         LDKPublicKey val_ref;
37582         CHECK(val->arr_len == 33);
37583         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37584         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
37585 }
37586
37587 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_revocation_basepoint"))) TS_OpenChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
37588         LDKOpenChannelV2 this_ptr_conv;
37589         this_ptr_conv.inner = untag_ptr(this_ptr);
37590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37592         this_ptr_conv.is_owned = false;
37593         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37594         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
37595         return ret_arr;
37596 }
37597
37598 void  __attribute__((export_name("TS_OpenChannelV2_set_revocation_basepoint"))) TS_OpenChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
37599         LDKOpenChannelV2 this_ptr_conv;
37600         this_ptr_conv.inner = untag_ptr(this_ptr);
37601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37603         this_ptr_conv.is_owned = false;
37604         LDKPublicKey val_ref;
37605         CHECK(val->arr_len == 33);
37606         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37607         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
37608 }
37609
37610 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_payment_basepoint"))) TS_OpenChannelV2_get_payment_basepoint(uint64_t this_ptr) {
37611         LDKOpenChannelV2 this_ptr_conv;
37612         this_ptr_conv.inner = untag_ptr(this_ptr);
37613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37615         this_ptr_conv.is_owned = false;
37616         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37617         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37618         return ret_arr;
37619 }
37620
37621 void  __attribute__((export_name("TS_OpenChannelV2_set_payment_basepoint"))) TS_OpenChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37622         LDKOpenChannelV2 this_ptr_conv;
37623         this_ptr_conv.inner = untag_ptr(this_ptr);
37624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37626         this_ptr_conv.is_owned = false;
37627         LDKPublicKey val_ref;
37628         CHECK(val->arr_len == 33);
37629         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37630         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
37631 }
37632
37633 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_delayed_payment_basepoint"))) TS_OpenChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
37634         LDKOpenChannelV2 this_ptr_conv;
37635         this_ptr_conv.inner = untag_ptr(this_ptr);
37636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37638         this_ptr_conv.is_owned = false;
37639         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37640         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37641         return ret_arr;
37642 }
37643
37644 void  __attribute__((export_name("TS_OpenChannelV2_set_delayed_payment_basepoint"))) TS_OpenChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37645         LDKOpenChannelV2 this_ptr_conv;
37646         this_ptr_conv.inner = untag_ptr(this_ptr);
37647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37649         this_ptr_conv.is_owned = false;
37650         LDKPublicKey val_ref;
37651         CHECK(val->arr_len == 33);
37652         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37653         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37654 }
37655
37656 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_htlc_basepoint"))) TS_OpenChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
37657         LDKOpenChannelV2 this_ptr_conv;
37658         this_ptr_conv.inner = untag_ptr(this_ptr);
37659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37661         this_ptr_conv.is_owned = false;
37662         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37663         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
37664         return ret_arr;
37665 }
37666
37667 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_basepoint"))) TS_OpenChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
37668         LDKOpenChannelV2 this_ptr_conv;
37669         this_ptr_conv.inner = untag_ptr(this_ptr);
37670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37672         this_ptr_conv.is_owned = false;
37673         LDKPublicKey val_ref;
37674         CHECK(val->arr_len == 33);
37675         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37676         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
37677 }
37678
37679 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_first_per_commitment_point"))) TS_OpenChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
37680         LDKOpenChannelV2 this_ptr_conv;
37681         this_ptr_conv.inner = untag_ptr(this_ptr);
37682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37684         this_ptr_conv.is_owned = false;
37685         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37686         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37687         return ret_arr;
37688 }
37689
37690 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) {
37691         LDKOpenChannelV2 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         LDKPublicKey val_ref;
37697         CHECK(val->arr_len == 33);
37698         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37699         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
37700 }
37701
37702 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
37703         LDKOpenChannelV2 this_ptr_conv;
37704         this_ptr_conv.inner = untag_ptr(this_ptr);
37705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37707         this_ptr_conv.is_owned = false;
37708         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37709         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37710         return ret_arr;
37711 }
37712
37713 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) {
37714         LDKOpenChannelV2 this_ptr_conv;
37715         this_ptr_conv.inner = untag_ptr(this_ptr);
37716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37718         this_ptr_conv.is_owned = false;
37719         LDKPublicKey val_ref;
37720         CHECK(val->arr_len == 33);
37721         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37722         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
37723 }
37724
37725 int8_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_flags"))) TS_OpenChannelV2_get_channel_flags(uint64_t this_ptr) {
37726         LDKOpenChannelV2 this_ptr_conv;
37727         this_ptr_conv.inner = untag_ptr(this_ptr);
37728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37730         this_ptr_conv.is_owned = false;
37731         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
37732         return ret_conv;
37733 }
37734
37735 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_flags"))) TS_OpenChannelV2_set_channel_flags(uint64_t this_ptr, int8_t val) {
37736         LDKOpenChannelV2 this_ptr_conv;
37737         this_ptr_conv.inner = untag_ptr(this_ptr);
37738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37740         this_ptr_conv.is_owned = false;
37741         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
37742 }
37743
37744 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_shutdown_scriptpubkey"))) TS_OpenChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
37745         LDKOpenChannelV2 this_ptr_conv;
37746         this_ptr_conv.inner = untag_ptr(this_ptr);
37747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37749         this_ptr_conv.is_owned = false;
37750         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
37751         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
37752         uint64_t ret_ref = tag_ptr(ret_copy, true);
37753         return ret_ref;
37754 }
37755
37756 void  __attribute__((export_name("TS_OpenChannelV2_set_shutdown_scriptpubkey"))) TS_OpenChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
37757         LDKOpenChannelV2 this_ptr_conv;
37758         this_ptr_conv.inner = untag_ptr(this_ptr);
37759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37761         this_ptr_conv.is_owned = false;
37762         void* val_ptr = untag_ptr(val);
37763         CHECK_ACCESS(val_ptr);
37764         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
37765         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
37766         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
37767 }
37768
37769 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_type"))) TS_OpenChannelV2_get_channel_type(uint64_t this_ptr) {
37770         LDKOpenChannelV2 this_ptr_conv;
37771         this_ptr_conv.inner = untag_ptr(this_ptr);
37772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37774         this_ptr_conv.is_owned = false;
37775         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
37776         uint64_t ret_ref = 0;
37777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37779         return ret_ref;
37780 }
37781
37782 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_type"))) TS_OpenChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
37783         LDKOpenChannelV2 this_ptr_conv;
37784         this_ptr_conv.inner = untag_ptr(this_ptr);
37785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37787         this_ptr_conv.is_owned = false;
37788         LDKChannelTypeFeatures val_conv;
37789         val_conv.inner = untag_ptr(val);
37790         val_conv.is_owned = ptr_is_owned(val);
37791         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37792         val_conv = ChannelTypeFeatures_clone(&val_conv);
37793         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
37794 }
37795
37796 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
37797         LDKOpenChannelV2 this_ptr_conv;
37798         this_ptr_conv.inner = untag_ptr(this_ptr);
37799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37801         this_ptr_conv.is_owned = false;
37802         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
37803         return ret_conv;
37804 }
37805
37806 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
37807         LDKOpenChannelV2 this_ptr_conv;
37808         this_ptr_conv.inner = untag_ptr(this_ptr);
37809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37811         this_ptr_conv.is_owned = false;
37812         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
37813         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
37814 }
37815
37816 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) {
37817         LDKThirtyTwoBytes chain_hash_arg_ref;
37818         CHECK(chain_hash_arg->arr_len == 32);
37819         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
37820         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
37821         CHECK(temporary_channel_id_arg->arr_len == 32);
37822         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
37823         LDKPublicKey funding_pubkey_arg_ref;
37824         CHECK(funding_pubkey_arg->arr_len == 33);
37825         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
37826         LDKPublicKey revocation_basepoint_arg_ref;
37827         CHECK(revocation_basepoint_arg->arr_len == 33);
37828         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
37829         LDKPublicKey payment_basepoint_arg_ref;
37830         CHECK(payment_basepoint_arg->arr_len == 33);
37831         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
37832         LDKPublicKey delayed_payment_basepoint_arg_ref;
37833         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
37834         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
37835         LDKPublicKey htlc_basepoint_arg_ref;
37836         CHECK(htlc_basepoint_arg->arr_len == 33);
37837         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
37838         LDKPublicKey first_per_commitment_point_arg_ref;
37839         CHECK(first_per_commitment_point_arg->arr_len == 33);
37840         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
37841         LDKPublicKey second_per_commitment_point_arg_ref;
37842         CHECK(second_per_commitment_point_arg->arr_len == 33);
37843         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
37844         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
37845         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
37846         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
37847         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
37848         LDKChannelTypeFeatures channel_type_arg_conv;
37849         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37850         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37851         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37852         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37853         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
37854         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);
37855         uint64_t ret_ref = 0;
37856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37858         return ret_ref;
37859 }
37860
37861 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
37862         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
37863         uint64_t ret_ref = 0;
37864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37866         return ret_ref;
37867 }
37868 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
37869         LDKOpenChannelV2 arg_conv;
37870         arg_conv.inner = untag_ptr(arg);
37871         arg_conv.is_owned = ptr_is_owned(arg);
37872         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37873         arg_conv.is_owned = false;
37874         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
37875         return ret_conv;
37876 }
37877
37878 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
37879         LDKOpenChannelV2 orig_conv;
37880         orig_conv.inner = untag_ptr(orig);
37881         orig_conv.is_owned = ptr_is_owned(orig);
37882         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37883         orig_conv.is_owned = false;
37884         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
37885         uint64_t ret_ref = 0;
37886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37888         return ret_ref;
37889 }
37890
37891 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
37892         LDKOpenChannelV2 a_conv;
37893         a_conv.inner = untag_ptr(a);
37894         a_conv.is_owned = ptr_is_owned(a);
37895         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37896         a_conv.is_owned = false;
37897         LDKOpenChannelV2 b_conv;
37898         b_conv.inner = untag_ptr(b);
37899         b_conv.is_owned = ptr_is_owned(b);
37900         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37901         b_conv.is_owned = false;
37902         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
37903         return ret_conv;
37904 }
37905
37906 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
37907         LDKAcceptChannel this_obj_conv;
37908         this_obj_conv.inner = untag_ptr(this_obj);
37909         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37911         AcceptChannel_free(this_obj_conv);
37912 }
37913
37914 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
37915         LDKAcceptChannel this_ptr_conv;
37916         this_ptr_conv.inner = untag_ptr(this_ptr);
37917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37919         this_ptr_conv.is_owned = false;
37920         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37921         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
37922         return ret_arr;
37923 }
37924
37925 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
37926         LDKAcceptChannel this_ptr_conv;
37927         this_ptr_conv.inner = untag_ptr(this_ptr);
37928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37930         this_ptr_conv.is_owned = false;
37931         LDKThirtyTwoBytes val_ref;
37932         CHECK(val->arr_len == 32);
37933         memcpy(val_ref.data, val->elems, 32); FREE(val);
37934         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
37935 }
37936
37937 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
37938         LDKAcceptChannel this_ptr_conv;
37939         this_ptr_conv.inner = untag_ptr(this_ptr);
37940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37942         this_ptr_conv.is_owned = false;
37943         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
37944         return ret_conv;
37945 }
37946
37947 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
37948         LDKAcceptChannel this_ptr_conv;
37949         this_ptr_conv.inner = untag_ptr(this_ptr);
37950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37952         this_ptr_conv.is_owned = false;
37953         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
37954 }
37955
37956 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) {
37957         LDKAcceptChannel this_ptr_conv;
37958         this_ptr_conv.inner = untag_ptr(this_ptr);
37959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37961         this_ptr_conv.is_owned = false;
37962         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
37963         return ret_conv;
37964 }
37965
37966 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) {
37967         LDKAcceptChannel this_ptr_conv;
37968         this_ptr_conv.inner = untag_ptr(this_ptr);
37969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37971         this_ptr_conv.is_owned = false;
37972         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37973 }
37974
37975 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
37976         LDKAcceptChannel this_ptr_conv;
37977         this_ptr_conv.inner = untag_ptr(this_ptr);
37978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37980         this_ptr_conv.is_owned = false;
37981         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
37982         return ret_conv;
37983 }
37984
37985 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
37986         LDKAcceptChannel this_ptr_conv;
37987         this_ptr_conv.inner = untag_ptr(this_ptr);
37988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37990         this_ptr_conv.is_owned = false;
37991         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
37992 }
37993
37994 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
37995         LDKAcceptChannel this_ptr_conv;
37996         this_ptr_conv.inner = untag_ptr(this_ptr);
37997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37999         this_ptr_conv.is_owned = false;
38000         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
38001         return ret_conv;
38002 }
38003
38004 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38005         LDKAcceptChannel this_ptr_conv;
38006         this_ptr_conv.inner = untag_ptr(this_ptr);
38007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38009         this_ptr_conv.is_owned = false;
38010         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
38011 }
38012
38013 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
38014         LDKAcceptChannel this_ptr_conv;
38015         this_ptr_conv.inner = untag_ptr(this_ptr);
38016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38018         this_ptr_conv.is_owned = false;
38019         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
38020         return ret_conv;
38021 }
38022
38023 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
38024         LDKAcceptChannel this_ptr_conv;
38025         this_ptr_conv.inner = untag_ptr(this_ptr);
38026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38028         this_ptr_conv.is_owned = false;
38029         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
38030 }
38031
38032 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
38033         LDKAcceptChannel this_ptr_conv;
38034         this_ptr_conv.inner = untag_ptr(this_ptr);
38035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38037         this_ptr_conv.is_owned = false;
38038         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
38039         return ret_conv;
38040 }
38041
38042 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
38043         LDKAcceptChannel this_ptr_conv;
38044         this_ptr_conv.inner = untag_ptr(this_ptr);
38045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38047         this_ptr_conv.is_owned = false;
38048         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
38049 }
38050
38051 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
38052         LDKAcceptChannel 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         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
38058         return ret_conv;
38059 }
38060
38061 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
38062         LDKAcceptChannel 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         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
38068 }
38069
38070 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
38071         LDKAcceptChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38077         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38078         return ret_arr;
38079 }
38080
38081 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38082         LDKAcceptChannel this_ptr_conv;
38083         this_ptr_conv.inner = untag_ptr(this_ptr);
38084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38086         this_ptr_conv.is_owned = false;
38087         LDKPublicKey val_ref;
38088         CHECK(val->arr_len == 33);
38089         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38090         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
38091 }
38092
38093 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
38094         LDKAcceptChannel this_ptr_conv;
38095         this_ptr_conv.inner = untag_ptr(this_ptr);
38096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38098         this_ptr_conv.is_owned = false;
38099         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38100         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38101         return ret_arr;
38102 }
38103
38104 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38105         LDKAcceptChannel this_ptr_conv;
38106         this_ptr_conv.inner = untag_ptr(this_ptr);
38107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38109         this_ptr_conv.is_owned = false;
38110         LDKPublicKey val_ref;
38111         CHECK(val->arr_len == 33);
38112         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38113         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
38114 }
38115
38116 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
38117         LDKAcceptChannel this_ptr_conv;
38118         this_ptr_conv.inner = untag_ptr(this_ptr);
38119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38121         this_ptr_conv.is_owned = false;
38122         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38123         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
38124         return ret_arr;
38125 }
38126
38127 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38128         LDKAcceptChannel this_ptr_conv;
38129         this_ptr_conv.inner = untag_ptr(this_ptr);
38130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38132         this_ptr_conv.is_owned = false;
38133         LDKPublicKey val_ref;
38134         CHECK(val->arr_len == 33);
38135         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38136         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
38137 }
38138
38139 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
38140         LDKAcceptChannel this_ptr_conv;
38141         this_ptr_conv.inner = untag_ptr(this_ptr);
38142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38144         this_ptr_conv.is_owned = false;
38145         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38146         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38147         return ret_arr;
38148 }
38149
38150 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38151         LDKAcceptChannel this_ptr_conv;
38152         this_ptr_conv.inner = untag_ptr(this_ptr);
38153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38155         this_ptr_conv.is_owned = false;
38156         LDKPublicKey val_ref;
38157         CHECK(val->arr_len == 33);
38158         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38159         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38160 }
38161
38162 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
38163         LDKAcceptChannel this_ptr_conv;
38164         this_ptr_conv.inner = untag_ptr(this_ptr);
38165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38167         this_ptr_conv.is_owned = false;
38168         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38169         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38170         return ret_arr;
38171 }
38172
38173 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38174         LDKAcceptChannel this_ptr_conv;
38175         this_ptr_conv.inner = untag_ptr(this_ptr);
38176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38178         this_ptr_conv.is_owned = false;
38179         LDKPublicKey val_ref;
38180         CHECK(val->arr_len == 33);
38181         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38182         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
38183 }
38184
38185 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
38186         LDKAcceptChannel this_ptr_conv;
38187         this_ptr_conv.inner = untag_ptr(this_ptr);
38188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38190         this_ptr_conv.is_owned = false;
38191         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38192         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38193         return ret_arr;
38194 }
38195
38196 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) {
38197         LDKAcceptChannel this_ptr_conv;
38198         this_ptr_conv.inner = untag_ptr(this_ptr);
38199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38201         this_ptr_conv.is_owned = false;
38202         LDKPublicKey val_ref;
38203         CHECK(val->arr_len == 33);
38204         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38205         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
38206 }
38207
38208 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_shutdown_scriptpubkey"))) TS_AcceptChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
38209         LDKAcceptChannel this_ptr_conv;
38210         this_ptr_conv.inner = untag_ptr(this_ptr);
38211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38213         this_ptr_conv.is_owned = false;
38214         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
38215         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
38216         uint64_t ret_ref = tag_ptr(ret_copy, true);
38217         return ret_ref;
38218 }
38219
38220 void  __attribute__((export_name("TS_AcceptChannel_set_shutdown_scriptpubkey"))) TS_AcceptChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
38221         LDKAcceptChannel this_ptr_conv;
38222         this_ptr_conv.inner = untag_ptr(this_ptr);
38223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38225         this_ptr_conv.is_owned = false;
38226         void* val_ptr = untag_ptr(val);
38227         CHECK_ACCESS(val_ptr);
38228         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
38229         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
38230         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
38231 }
38232
38233 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
38234         LDKAcceptChannel this_ptr_conv;
38235         this_ptr_conv.inner = untag_ptr(this_ptr);
38236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38238         this_ptr_conv.is_owned = false;
38239         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
38240         uint64_t ret_ref = 0;
38241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38243         return ret_ref;
38244 }
38245
38246 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
38247         LDKAcceptChannel this_ptr_conv;
38248         this_ptr_conv.inner = untag_ptr(this_ptr);
38249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38251         this_ptr_conv.is_owned = false;
38252         LDKChannelTypeFeatures val_conv;
38253         val_conv.inner = untag_ptr(val);
38254         val_conv.is_owned = ptr_is_owned(val);
38255         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38256         val_conv = ChannelTypeFeatures_clone(&val_conv);
38257         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
38258 }
38259
38260 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) {
38261         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38262         CHECK(temporary_channel_id_arg->arr_len == 32);
38263         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38264         LDKPublicKey funding_pubkey_arg_ref;
38265         CHECK(funding_pubkey_arg->arr_len == 33);
38266         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38267         LDKPublicKey revocation_basepoint_arg_ref;
38268         CHECK(revocation_basepoint_arg->arr_len == 33);
38269         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38270         LDKPublicKey payment_point_arg_ref;
38271         CHECK(payment_point_arg->arr_len == 33);
38272         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38273         LDKPublicKey delayed_payment_basepoint_arg_ref;
38274         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38275         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38276         LDKPublicKey htlc_basepoint_arg_ref;
38277         CHECK(htlc_basepoint_arg->arr_len == 33);
38278         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38279         LDKPublicKey first_per_commitment_point_arg_ref;
38280         CHECK(first_per_commitment_point_arg->arr_len == 33);
38281         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
38282         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
38283         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
38284         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
38285         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
38286         LDKChannelTypeFeatures channel_type_arg_conv;
38287         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
38288         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
38289         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
38290         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
38291         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);
38292         uint64_t ret_ref = 0;
38293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38295         return ret_ref;
38296 }
38297
38298 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
38299         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
38300         uint64_t ret_ref = 0;
38301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38303         return ret_ref;
38304 }
38305 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
38306         LDKAcceptChannel arg_conv;
38307         arg_conv.inner = untag_ptr(arg);
38308         arg_conv.is_owned = ptr_is_owned(arg);
38309         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38310         arg_conv.is_owned = false;
38311         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
38312         return ret_conv;
38313 }
38314
38315 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
38316         LDKAcceptChannel orig_conv;
38317         orig_conv.inner = untag_ptr(orig);
38318         orig_conv.is_owned = ptr_is_owned(orig);
38319         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38320         orig_conv.is_owned = false;
38321         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
38322         uint64_t ret_ref = 0;
38323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38325         return ret_ref;
38326 }
38327
38328 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
38329         LDKAcceptChannel a_conv;
38330         a_conv.inner = untag_ptr(a);
38331         a_conv.is_owned = ptr_is_owned(a);
38332         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38333         a_conv.is_owned = false;
38334         LDKAcceptChannel b_conv;
38335         b_conv.inner = untag_ptr(b);
38336         b_conv.is_owned = ptr_is_owned(b);
38337         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38338         b_conv.is_owned = false;
38339         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
38340         return ret_conv;
38341 }
38342
38343 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
38344         LDKAcceptChannelV2 this_obj_conv;
38345         this_obj_conv.inner = untag_ptr(this_obj);
38346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38348         AcceptChannelV2_free(this_obj_conv);
38349 }
38350
38351 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_temporary_channel_id"))) TS_AcceptChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
38352         LDKAcceptChannelV2 this_ptr_conv;
38353         this_ptr_conv.inner = untag_ptr(this_ptr);
38354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38356         this_ptr_conv.is_owned = false;
38357         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38358         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
38359         return ret_arr;
38360 }
38361
38362 void  __attribute__((export_name("TS_AcceptChannelV2_set_temporary_channel_id"))) TS_AcceptChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
38363         LDKAcceptChannelV2 this_ptr_conv;
38364         this_ptr_conv.inner = untag_ptr(this_ptr);
38365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38367         this_ptr_conv.is_owned = false;
38368         LDKThirtyTwoBytes val_ref;
38369         CHECK(val->arr_len == 32);
38370         memcpy(val_ref.data, val->elems, 32); FREE(val);
38371         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
38372 }
38373
38374 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
38375         LDKAcceptChannelV2 this_ptr_conv;
38376         this_ptr_conv.inner = untag_ptr(this_ptr);
38377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38379         this_ptr_conv.is_owned = false;
38380         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
38381         return ret_conv;
38382 }
38383
38384 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
38385         LDKAcceptChannelV2 this_ptr_conv;
38386         this_ptr_conv.inner = untag_ptr(this_ptr);
38387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38389         this_ptr_conv.is_owned = false;
38390         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
38391 }
38392
38393 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_dust_limit_satoshis"))) TS_AcceptChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
38394         LDKAcceptChannelV2 this_ptr_conv;
38395         this_ptr_conv.inner = untag_ptr(this_ptr);
38396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38398         this_ptr_conv.is_owned = false;
38399         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
38400         return ret_conv;
38401 }
38402
38403 void  __attribute__((export_name("TS_AcceptChannelV2_set_dust_limit_satoshis"))) TS_AcceptChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
38404         LDKAcceptChannelV2 this_ptr_conv;
38405         this_ptr_conv.inner = untag_ptr(this_ptr);
38406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38408         this_ptr_conv.is_owned = false;
38409         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
38410 }
38411
38412 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) {
38413         LDKAcceptChannelV2 this_ptr_conv;
38414         this_ptr_conv.inner = untag_ptr(this_ptr);
38415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38417         this_ptr_conv.is_owned = false;
38418         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
38419         return ret_conv;
38420 }
38421
38422 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) {
38423         LDKAcceptChannelV2 this_ptr_conv;
38424         this_ptr_conv.inner = untag_ptr(this_ptr);
38425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38427         this_ptr_conv.is_owned = false;
38428         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
38429 }
38430
38431 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_minimum_msat"))) TS_AcceptChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
38432         LDKAcceptChannelV2 this_ptr_conv;
38433         this_ptr_conv.inner = untag_ptr(this_ptr);
38434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38436         this_ptr_conv.is_owned = false;
38437         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
38438         return ret_conv;
38439 }
38440
38441 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_minimum_msat"))) TS_AcceptChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38442         LDKAcceptChannelV2 this_ptr_conv;
38443         this_ptr_conv.inner = untag_ptr(this_ptr);
38444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38446         this_ptr_conv.is_owned = false;
38447         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
38448 }
38449
38450 int32_t  __attribute__((export_name("TS_AcceptChannelV2_get_minimum_depth"))) TS_AcceptChannelV2_get_minimum_depth(uint64_t this_ptr) {
38451         LDKAcceptChannelV2 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         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
38457         return ret_conv;
38458 }
38459
38460 void  __attribute__((export_name("TS_AcceptChannelV2_set_minimum_depth"))) TS_AcceptChannelV2_set_minimum_depth(uint64_t this_ptr, int32_t val) {
38461         LDKAcceptChannelV2 this_ptr_conv;
38462         this_ptr_conv.inner = untag_ptr(this_ptr);
38463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38465         this_ptr_conv.is_owned = false;
38466         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
38467 }
38468
38469 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_to_self_delay"))) TS_AcceptChannelV2_get_to_self_delay(uint64_t this_ptr) {
38470         LDKAcceptChannelV2 this_ptr_conv;
38471         this_ptr_conv.inner = untag_ptr(this_ptr);
38472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38474         this_ptr_conv.is_owned = false;
38475         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
38476         return ret_conv;
38477 }
38478
38479 void  __attribute__((export_name("TS_AcceptChannelV2_set_to_self_delay"))) TS_AcceptChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
38480         LDKAcceptChannelV2 this_ptr_conv;
38481         this_ptr_conv.inner = untag_ptr(this_ptr);
38482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38484         this_ptr_conv.is_owned = false;
38485         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
38486 }
38487
38488 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_accepted_htlcs"))) TS_AcceptChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
38489         LDKAcceptChannelV2 this_ptr_conv;
38490         this_ptr_conv.inner = untag_ptr(this_ptr);
38491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38493         this_ptr_conv.is_owned = false;
38494         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
38495         return ret_conv;
38496 }
38497
38498 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_accepted_htlcs"))) TS_AcceptChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
38499         LDKAcceptChannelV2 this_ptr_conv;
38500         this_ptr_conv.inner = untag_ptr(this_ptr);
38501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38503         this_ptr_conv.is_owned = false;
38504         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
38505 }
38506
38507 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_funding_pubkey"))) TS_AcceptChannelV2_get_funding_pubkey(uint64_t this_ptr) {
38508         LDKAcceptChannelV2 this_ptr_conv;
38509         this_ptr_conv.inner = untag_ptr(this_ptr);
38510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38512         this_ptr_conv.is_owned = false;
38513         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38514         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38515         return ret_arr;
38516 }
38517
38518 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_pubkey"))) TS_AcceptChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38519         LDKAcceptChannelV2 this_ptr_conv;
38520         this_ptr_conv.inner = untag_ptr(this_ptr);
38521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38523         this_ptr_conv.is_owned = false;
38524         LDKPublicKey val_ref;
38525         CHECK(val->arr_len == 33);
38526         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38527         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
38528 }
38529
38530 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_revocation_basepoint"))) TS_AcceptChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
38531         LDKAcceptChannelV2 this_ptr_conv;
38532         this_ptr_conv.inner = untag_ptr(this_ptr);
38533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38535         this_ptr_conv.is_owned = false;
38536         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38537         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38538         return ret_arr;
38539 }
38540
38541 void  __attribute__((export_name("TS_AcceptChannelV2_set_revocation_basepoint"))) TS_AcceptChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38542         LDKAcceptChannelV2 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         LDKPublicKey val_ref;
38548         CHECK(val->arr_len == 33);
38549         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38550         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
38551 }
38552
38553 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_payment_basepoint"))) TS_AcceptChannelV2_get_payment_basepoint(uint64_t this_ptr) {
38554         LDKAcceptChannelV2 this_ptr_conv;
38555         this_ptr_conv.inner = untag_ptr(this_ptr);
38556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38558         this_ptr_conv.is_owned = false;
38559         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38560         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38561         return ret_arr;
38562 }
38563
38564 void  __attribute__((export_name("TS_AcceptChannelV2_set_payment_basepoint"))) TS_AcceptChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38565         LDKAcceptChannelV2 this_ptr_conv;
38566         this_ptr_conv.inner = untag_ptr(this_ptr);
38567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38569         this_ptr_conv.is_owned = false;
38570         LDKPublicKey val_ref;
38571         CHECK(val->arr_len == 33);
38572         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38573         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
38574 }
38575
38576 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_delayed_payment_basepoint"))) TS_AcceptChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
38577         LDKAcceptChannelV2 this_ptr_conv;
38578         this_ptr_conv.inner = untag_ptr(this_ptr);
38579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38581         this_ptr_conv.is_owned = false;
38582         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38583         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38584         return ret_arr;
38585 }
38586
38587 void  __attribute__((export_name("TS_AcceptChannelV2_set_delayed_payment_basepoint"))) TS_AcceptChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38588         LDKAcceptChannelV2 this_ptr_conv;
38589         this_ptr_conv.inner = untag_ptr(this_ptr);
38590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38592         this_ptr_conv.is_owned = false;
38593         LDKPublicKey val_ref;
38594         CHECK(val->arr_len == 33);
38595         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38596         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38597 }
38598
38599 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_basepoint"))) TS_AcceptChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
38600         LDKAcceptChannelV2 this_ptr_conv;
38601         this_ptr_conv.inner = untag_ptr(this_ptr);
38602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38604         this_ptr_conv.is_owned = false;
38605         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38606         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38607         return ret_arr;
38608 }
38609
38610 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_basepoint"))) TS_AcceptChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38611         LDKAcceptChannelV2 this_ptr_conv;
38612         this_ptr_conv.inner = untag_ptr(this_ptr);
38613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38615         this_ptr_conv.is_owned = false;
38616         LDKPublicKey val_ref;
38617         CHECK(val->arr_len == 33);
38618         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38619         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
38620 }
38621
38622 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_first_per_commitment_point"))) TS_AcceptChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
38623         LDKAcceptChannelV2 this_ptr_conv;
38624         this_ptr_conv.inner = untag_ptr(this_ptr);
38625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38627         this_ptr_conv.is_owned = false;
38628         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38629         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38630         return ret_arr;
38631 }
38632
38633 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) {
38634         LDKAcceptChannelV2 this_ptr_conv;
38635         this_ptr_conv.inner = untag_ptr(this_ptr);
38636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38638         this_ptr_conv.is_owned = false;
38639         LDKPublicKey val_ref;
38640         CHECK(val->arr_len == 33);
38641         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38642         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
38643 }
38644
38645 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
38646         LDKAcceptChannelV2 this_ptr_conv;
38647         this_ptr_conv.inner = untag_ptr(this_ptr);
38648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38650         this_ptr_conv.is_owned = false;
38651         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38652         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38653         return ret_arr;
38654 }
38655
38656 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) {
38657         LDKAcceptChannelV2 this_ptr_conv;
38658         this_ptr_conv.inner = untag_ptr(this_ptr);
38659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38661         this_ptr_conv.is_owned = false;
38662         LDKPublicKey val_ref;
38663         CHECK(val->arr_len == 33);
38664         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38665         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
38666 }
38667
38668 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_shutdown_scriptpubkey"))) TS_AcceptChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
38669         LDKAcceptChannelV2 this_ptr_conv;
38670         this_ptr_conv.inner = untag_ptr(this_ptr);
38671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38673         this_ptr_conv.is_owned = false;
38674         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
38675         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
38676         uint64_t ret_ref = tag_ptr(ret_copy, true);
38677         return ret_ref;
38678 }
38679
38680 void  __attribute__((export_name("TS_AcceptChannelV2_set_shutdown_scriptpubkey"))) TS_AcceptChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
38681         LDKAcceptChannelV2 this_ptr_conv;
38682         this_ptr_conv.inner = untag_ptr(this_ptr);
38683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38685         this_ptr_conv.is_owned = false;
38686         void* val_ptr = untag_ptr(val);
38687         CHECK_ACCESS(val_ptr);
38688         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
38689         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
38690         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
38691 }
38692
38693 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_channel_type"))) TS_AcceptChannelV2_get_channel_type(uint64_t this_ptr) {
38694         LDKAcceptChannelV2 this_ptr_conv;
38695         this_ptr_conv.inner = untag_ptr(this_ptr);
38696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38698         this_ptr_conv.is_owned = false;
38699         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
38700         uint64_t ret_ref = 0;
38701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38703         return ret_ref;
38704 }
38705
38706 void  __attribute__((export_name("TS_AcceptChannelV2_set_channel_type"))) TS_AcceptChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
38707         LDKAcceptChannelV2 this_ptr_conv;
38708         this_ptr_conv.inner = untag_ptr(this_ptr);
38709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38711         this_ptr_conv.is_owned = false;
38712         LDKChannelTypeFeatures val_conv;
38713         val_conv.inner = untag_ptr(val);
38714         val_conv.is_owned = ptr_is_owned(val);
38715         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38716         val_conv = ChannelTypeFeatures_clone(&val_conv);
38717         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
38718 }
38719
38720 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
38721         LDKAcceptChannelV2 this_ptr_conv;
38722         this_ptr_conv.inner = untag_ptr(this_ptr);
38723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38725         this_ptr_conv.is_owned = false;
38726         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
38727         return ret_conv;
38728 }
38729
38730 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
38731         LDKAcceptChannelV2 this_ptr_conv;
38732         this_ptr_conv.inner = untag_ptr(this_ptr);
38733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38735         this_ptr_conv.is_owned = false;
38736         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38737         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
38738 }
38739
38740 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) {
38741         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38742         CHECK(temporary_channel_id_arg->arr_len == 32);
38743         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38744         LDKPublicKey funding_pubkey_arg_ref;
38745         CHECK(funding_pubkey_arg->arr_len == 33);
38746         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38747         LDKPublicKey revocation_basepoint_arg_ref;
38748         CHECK(revocation_basepoint_arg->arr_len == 33);
38749         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38750         LDKPublicKey payment_basepoint_arg_ref;
38751         CHECK(payment_basepoint_arg->arr_len == 33);
38752         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
38753         LDKPublicKey delayed_payment_basepoint_arg_ref;
38754         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38755         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38756         LDKPublicKey htlc_basepoint_arg_ref;
38757         CHECK(htlc_basepoint_arg->arr_len == 33);
38758         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38759         LDKPublicKey first_per_commitment_point_arg_ref;
38760         CHECK(first_per_commitment_point_arg->arr_len == 33);
38761         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
38762         LDKPublicKey second_per_commitment_point_arg_ref;
38763         CHECK(second_per_commitment_point_arg->arr_len == 33);
38764         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
38765         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
38766         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
38767         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
38768         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
38769         LDKChannelTypeFeatures channel_type_arg_conv;
38770         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
38771         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
38772         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
38773         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
38774         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
38775         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);
38776         uint64_t ret_ref = 0;
38777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38779         return ret_ref;
38780 }
38781
38782 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
38783         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
38784         uint64_t ret_ref = 0;
38785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38787         return ret_ref;
38788 }
38789 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
38790         LDKAcceptChannelV2 arg_conv;
38791         arg_conv.inner = untag_ptr(arg);
38792         arg_conv.is_owned = ptr_is_owned(arg);
38793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38794         arg_conv.is_owned = false;
38795         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
38796         return ret_conv;
38797 }
38798
38799 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
38800         LDKAcceptChannelV2 orig_conv;
38801         orig_conv.inner = untag_ptr(orig);
38802         orig_conv.is_owned = ptr_is_owned(orig);
38803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38804         orig_conv.is_owned = false;
38805         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
38806         uint64_t ret_ref = 0;
38807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38809         return ret_ref;
38810 }
38811
38812 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
38813         LDKAcceptChannelV2 a_conv;
38814         a_conv.inner = untag_ptr(a);
38815         a_conv.is_owned = ptr_is_owned(a);
38816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38817         a_conv.is_owned = false;
38818         LDKAcceptChannelV2 b_conv;
38819         b_conv.inner = untag_ptr(b);
38820         b_conv.is_owned = ptr_is_owned(b);
38821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38822         b_conv.is_owned = false;
38823         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
38824         return ret_conv;
38825 }
38826
38827 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
38828         LDKFundingCreated this_obj_conv;
38829         this_obj_conv.inner = untag_ptr(this_obj);
38830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38832         FundingCreated_free(this_obj_conv);
38833 }
38834
38835 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
38836         LDKFundingCreated this_ptr_conv;
38837         this_ptr_conv.inner = untag_ptr(this_ptr);
38838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38840         this_ptr_conv.is_owned = false;
38841         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38842         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
38843         return ret_arr;
38844 }
38845
38846 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
38847         LDKFundingCreated 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         LDKThirtyTwoBytes val_ref;
38853         CHECK(val->arr_len == 32);
38854         memcpy(val_ref.data, val->elems, 32); FREE(val);
38855         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
38856 }
38857
38858 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
38859         LDKFundingCreated this_ptr_conv;
38860         this_ptr_conv.inner = untag_ptr(this_ptr);
38861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38863         this_ptr_conv.is_owned = false;
38864         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38865         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
38866         return ret_arr;
38867 }
38868
38869 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
38870         LDKFundingCreated this_ptr_conv;
38871         this_ptr_conv.inner = untag_ptr(this_ptr);
38872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38874         this_ptr_conv.is_owned = false;
38875         LDKThirtyTwoBytes val_ref;
38876         CHECK(val->arr_len == 32);
38877         memcpy(val_ref.data, val->elems, 32); FREE(val);
38878         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
38879 }
38880
38881 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
38882         LDKFundingCreated this_ptr_conv;
38883         this_ptr_conv.inner = untag_ptr(this_ptr);
38884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38886         this_ptr_conv.is_owned = false;
38887         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
38888         return ret_conv;
38889 }
38890
38891 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
38892         LDKFundingCreated this_ptr_conv;
38893         this_ptr_conv.inner = untag_ptr(this_ptr);
38894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38896         this_ptr_conv.is_owned = false;
38897         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
38898 }
38899
38900 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
38901         LDKFundingCreated this_ptr_conv;
38902         this_ptr_conv.inner = untag_ptr(this_ptr);
38903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38905         this_ptr_conv.is_owned = false;
38906         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
38907         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
38908         return ret_arr;
38909 }
38910
38911 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
38912         LDKFundingCreated this_ptr_conv;
38913         this_ptr_conv.inner = untag_ptr(this_ptr);
38914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38916         this_ptr_conv.is_owned = false;
38917         LDKECDSASignature val_ref;
38918         CHECK(val->arr_len == 64);
38919         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
38920         FundingCreated_set_signature(&this_ptr_conv, val_ref);
38921 }
38922
38923 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) {
38924         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38925         CHECK(temporary_channel_id_arg->arr_len == 32);
38926         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38927         LDKThirtyTwoBytes funding_txid_arg_ref;
38928         CHECK(funding_txid_arg->arr_len == 32);
38929         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
38930         LDKECDSASignature signature_arg_ref;
38931         CHECK(signature_arg->arr_len == 64);
38932         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
38933         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
38934         uint64_t ret_ref = 0;
38935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38937         return ret_ref;
38938 }
38939
38940 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
38941         LDKFundingCreated ret_var = FundingCreated_clone(arg);
38942         uint64_t ret_ref = 0;
38943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38945         return ret_ref;
38946 }
38947 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
38948         LDKFundingCreated arg_conv;
38949         arg_conv.inner = untag_ptr(arg);
38950         arg_conv.is_owned = ptr_is_owned(arg);
38951         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38952         arg_conv.is_owned = false;
38953         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
38954         return ret_conv;
38955 }
38956
38957 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
38958         LDKFundingCreated orig_conv;
38959         orig_conv.inner = untag_ptr(orig);
38960         orig_conv.is_owned = ptr_is_owned(orig);
38961         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38962         orig_conv.is_owned = false;
38963         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
38964         uint64_t ret_ref = 0;
38965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38967         return ret_ref;
38968 }
38969
38970 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
38971         LDKFundingCreated a_conv;
38972         a_conv.inner = untag_ptr(a);
38973         a_conv.is_owned = ptr_is_owned(a);
38974         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38975         a_conv.is_owned = false;
38976         LDKFundingCreated b_conv;
38977         b_conv.inner = untag_ptr(b);
38978         b_conv.is_owned = ptr_is_owned(b);
38979         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38980         b_conv.is_owned = false;
38981         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
38982         return ret_conv;
38983 }
38984
38985 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
38986         LDKFundingSigned this_obj_conv;
38987         this_obj_conv.inner = untag_ptr(this_obj);
38988         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38990         FundingSigned_free(this_obj_conv);
38991 }
38992
38993 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
38994         LDKFundingSigned this_ptr_conv;
38995         this_ptr_conv.inner = untag_ptr(this_ptr);
38996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38998         this_ptr_conv.is_owned = false;
38999         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39000         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
39001         return ret_arr;
39002 }
39003
39004 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39005         LDKFundingSigned this_ptr_conv;
39006         this_ptr_conv.inner = untag_ptr(this_ptr);
39007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39009         this_ptr_conv.is_owned = false;
39010         LDKThirtyTwoBytes val_ref;
39011         CHECK(val->arr_len == 32);
39012         memcpy(val_ref.data, val->elems, 32); FREE(val);
39013         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
39014 }
39015
39016 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
39017         LDKFundingSigned this_ptr_conv;
39018         this_ptr_conv.inner = untag_ptr(this_ptr);
39019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39021         this_ptr_conv.is_owned = false;
39022         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39023         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
39024         return ret_arr;
39025 }
39026
39027 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
39028         LDKFundingSigned this_ptr_conv;
39029         this_ptr_conv.inner = untag_ptr(this_ptr);
39030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39032         this_ptr_conv.is_owned = false;
39033         LDKECDSASignature val_ref;
39034         CHECK(val->arr_len == 64);
39035         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39036         FundingSigned_set_signature(&this_ptr_conv, val_ref);
39037 }
39038
39039 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
39040         LDKThirtyTwoBytes channel_id_arg_ref;
39041         CHECK(channel_id_arg->arr_len == 32);
39042         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39043         LDKECDSASignature signature_arg_ref;
39044         CHECK(signature_arg->arr_len == 64);
39045         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
39046         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
39047         uint64_t ret_ref = 0;
39048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39050         return ret_ref;
39051 }
39052
39053 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
39054         LDKFundingSigned ret_var = FundingSigned_clone(arg);
39055         uint64_t ret_ref = 0;
39056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39058         return ret_ref;
39059 }
39060 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
39061         LDKFundingSigned arg_conv;
39062         arg_conv.inner = untag_ptr(arg);
39063         arg_conv.is_owned = ptr_is_owned(arg);
39064         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39065         arg_conv.is_owned = false;
39066         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
39067         return ret_conv;
39068 }
39069
39070 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
39071         LDKFundingSigned orig_conv;
39072         orig_conv.inner = untag_ptr(orig);
39073         orig_conv.is_owned = ptr_is_owned(orig);
39074         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39075         orig_conv.is_owned = false;
39076         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
39077         uint64_t ret_ref = 0;
39078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39080         return ret_ref;
39081 }
39082
39083 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
39084         LDKFundingSigned a_conv;
39085         a_conv.inner = untag_ptr(a);
39086         a_conv.is_owned = ptr_is_owned(a);
39087         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39088         a_conv.is_owned = false;
39089         LDKFundingSigned b_conv;
39090         b_conv.inner = untag_ptr(b);
39091         b_conv.is_owned = ptr_is_owned(b);
39092         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39093         b_conv.is_owned = false;
39094         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
39095         return ret_conv;
39096 }
39097
39098 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
39099         LDKChannelReady this_obj_conv;
39100         this_obj_conv.inner = untag_ptr(this_obj);
39101         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39103         ChannelReady_free(this_obj_conv);
39104 }
39105
39106 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
39107         LDKChannelReady this_ptr_conv;
39108         this_ptr_conv.inner = untag_ptr(this_ptr);
39109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39111         this_ptr_conv.is_owned = false;
39112         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39113         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
39114         return ret_arr;
39115 }
39116
39117 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39118         LDKChannelReady this_ptr_conv;
39119         this_ptr_conv.inner = untag_ptr(this_ptr);
39120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39122         this_ptr_conv.is_owned = false;
39123         LDKThirtyTwoBytes val_ref;
39124         CHECK(val->arr_len == 32);
39125         memcpy(val_ref.data, val->elems, 32); FREE(val);
39126         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
39127 }
39128
39129 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
39130         LDKChannelReady this_ptr_conv;
39131         this_ptr_conv.inner = untag_ptr(this_ptr);
39132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39134         this_ptr_conv.is_owned = false;
39135         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39136         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39137         return ret_arr;
39138 }
39139
39140 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) {
39141         LDKChannelReady this_ptr_conv;
39142         this_ptr_conv.inner = untag_ptr(this_ptr);
39143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39145         this_ptr_conv.is_owned = false;
39146         LDKPublicKey val_ref;
39147         CHECK(val->arr_len == 33);
39148         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39149         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
39150 }
39151
39152 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
39153         LDKChannelReady this_ptr_conv;
39154         this_ptr_conv.inner = untag_ptr(this_ptr);
39155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39157         this_ptr_conv.is_owned = false;
39158         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39159         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
39160         uint64_t ret_ref = tag_ptr(ret_copy, true);
39161         return ret_ref;
39162 }
39163
39164 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) {
39165         LDKChannelReady this_ptr_conv;
39166         this_ptr_conv.inner = untag_ptr(this_ptr);
39167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39169         this_ptr_conv.is_owned = false;
39170         void* val_ptr = untag_ptr(val);
39171         CHECK_ACCESS(val_ptr);
39172         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39173         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39174         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
39175 }
39176
39177 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) {
39178         LDKThirtyTwoBytes channel_id_arg_ref;
39179         CHECK(channel_id_arg->arr_len == 32);
39180         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39181         LDKPublicKey next_per_commitment_point_arg_ref;
39182         CHECK(next_per_commitment_point_arg->arr_len == 33);
39183         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
39184         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
39185         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
39186         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
39187         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
39188         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
39189         uint64_t ret_ref = 0;
39190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39192         return ret_ref;
39193 }
39194
39195 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
39196         LDKChannelReady ret_var = ChannelReady_clone(arg);
39197         uint64_t ret_ref = 0;
39198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39200         return ret_ref;
39201 }
39202 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
39203         LDKChannelReady arg_conv;
39204         arg_conv.inner = untag_ptr(arg);
39205         arg_conv.is_owned = ptr_is_owned(arg);
39206         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39207         arg_conv.is_owned = false;
39208         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
39209         return ret_conv;
39210 }
39211
39212 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
39213         LDKChannelReady orig_conv;
39214         orig_conv.inner = untag_ptr(orig);
39215         orig_conv.is_owned = ptr_is_owned(orig);
39216         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39217         orig_conv.is_owned = false;
39218         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
39219         uint64_t ret_ref = 0;
39220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39222         return ret_ref;
39223 }
39224
39225 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
39226         LDKChannelReady a_conv;
39227         a_conv.inner = untag_ptr(a);
39228         a_conv.is_owned = ptr_is_owned(a);
39229         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39230         a_conv.is_owned = false;
39231         LDKChannelReady b_conv;
39232         b_conv.inner = untag_ptr(b);
39233         b_conv.is_owned = ptr_is_owned(b);
39234         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39235         b_conv.is_owned = false;
39236         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
39237         return ret_conv;
39238 }
39239
39240 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
39241         LDKTxAddInput this_obj_conv;
39242         this_obj_conv.inner = untag_ptr(this_obj);
39243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39245         TxAddInput_free(this_obj_conv);
39246 }
39247
39248 int8_tArray  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
39249         LDKTxAddInput this_ptr_conv;
39250         this_ptr_conv.inner = untag_ptr(this_ptr);
39251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39253         this_ptr_conv.is_owned = false;
39254         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39255         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
39256         return ret_arr;
39257 }
39258
39259 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39260         LDKTxAddInput this_ptr_conv;
39261         this_ptr_conv.inner = untag_ptr(this_ptr);
39262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39264         this_ptr_conv.is_owned = false;
39265         LDKThirtyTwoBytes val_ref;
39266         CHECK(val->arr_len == 32);
39267         memcpy(val_ref.data, val->elems, 32); FREE(val);
39268         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
39269 }
39270
39271 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
39272         LDKTxAddInput this_ptr_conv;
39273         this_ptr_conv.inner = untag_ptr(this_ptr);
39274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39276         this_ptr_conv.is_owned = false;
39277         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
39278         return ret_conv;
39279 }
39280
39281 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
39282         LDKTxAddInput this_ptr_conv;
39283         this_ptr_conv.inner = untag_ptr(this_ptr);
39284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39286         this_ptr_conv.is_owned = false;
39287         TxAddInput_set_serial_id(&this_ptr_conv, val);
39288 }
39289
39290 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
39291         LDKTxAddInput this_ptr_conv;
39292         this_ptr_conv.inner = untag_ptr(this_ptr);
39293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39295         this_ptr_conv.is_owned = false;
39296         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
39297         uint64_t ret_ref = 0;
39298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39300         return ret_ref;
39301 }
39302
39303 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
39304         LDKTxAddInput this_ptr_conv;
39305         this_ptr_conv.inner = untag_ptr(this_ptr);
39306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39308         this_ptr_conv.is_owned = false;
39309         LDKTransactionU16LenLimited val_conv;
39310         val_conv.inner = untag_ptr(val);
39311         val_conv.is_owned = ptr_is_owned(val);
39312         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39313         val_conv = TransactionU16LenLimited_clone(&val_conv);
39314         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
39315 }
39316
39317 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
39318         LDKTxAddInput this_ptr_conv;
39319         this_ptr_conv.inner = untag_ptr(this_ptr);
39320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39322         this_ptr_conv.is_owned = false;
39323         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
39324         return ret_conv;
39325 }
39326
39327 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
39328         LDKTxAddInput this_ptr_conv;
39329         this_ptr_conv.inner = untag_ptr(this_ptr);
39330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39332         this_ptr_conv.is_owned = false;
39333         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
39334 }
39335
39336 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
39337         LDKTxAddInput this_ptr_conv;
39338         this_ptr_conv.inner = untag_ptr(this_ptr);
39339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39341         this_ptr_conv.is_owned = false;
39342         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
39343         return ret_conv;
39344 }
39345
39346 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
39347         LDKTxAddInput this_ptr_conv;
39348         this_ptr_conv.inner = untag_ptr(this_ptr);
39349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39351         this_ptr_conv.is_owned = false;
39352         TxAddInput_set_sequence(&this_ptr_conv, val);
39353 }
39354
39355 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) {
39356         LDKThirtyTwoBytes channel_id_arg_ref;
39357         CHECK(channel_id_arg->arr_len == 32);
39358         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39359         LDKTransactionU16LenLimited prevtx_arg_conv;
39360         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
39361         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
39362         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
39363         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
39364         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
39365         uint64_t ret_ref = 0;
39366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39368         return ret_ref;
39369 }
39370
39371 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
39372         LDKTxAddInput ret_var = TxAddInput_clone(arg);
39373         uint64_t ret_ref = 0;
39374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39376         return ret_ref;
39377 }
39378 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
39379         LDKTxAddInput arg_conv;
39380         arg_conv.inner = untag_ptr(arg);
39381         arg_conv.is_owned = ptr_is_owned(arg);
39382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39383         arg_conv.is_owned = false;
39384         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
39385         return ret_conv;
39386 }
39387
39388 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
39389         LDKTxAddInput orig_conv;
39390         orig_conv.inner = untag_ptr(orig);
39391         orig_conv.is_owned = ptr_is_owned(orig);
39392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39393         orig_conv.is_owned = false;
39394         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
39395         uint64_t ret_ref = 0;
39396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39398         return ret_ref;
39399 }
39400
39401 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
39402         LDKTxAddInput a_conv;
39403         a_conv.inner = untag_ptr(a);
39404         a_conv.is_owned = ptr_is_owned(a);
39405         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39406         a_conv.is_owned = false;
39407         LDKTxAddInput b_conv;
39408         b_conv.inner = untag_ptr(b);
39409         b_conv.is_owned = ptr_is_owned(b);
39410         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39411         b_conv.is_owned = false;
39412         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
39413         return ret_conv;
39414 }
39415
39416 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
39417         LDKTxAddOutput this_obj_conv;
39418         this_obj_conv.inner = untag_ptr(this_obj);
39419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39421         TxAddOutput_free(this_obj_conv);
39422 }
39423
39424 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
39425         LDKTxAddOutput this_ptr_conv;
39426         this_ptr_conv.inner = untag_ptr(this_ptr);
39427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39429         this_ptr_conv.is_owned = false;
39430         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39431         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
39432         return ret_arr;
39433 }
39434
39435 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39436         LDKTxAddOutput this_ptr_conv;
39437         this_ptr_conv.inner = untag_ptr(this_ptr);
39438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39440         this_ptr_conv.is_owned = false;
39441         LDKThirtyTwoBytes val_ref;
39442         CHECK(val->arr_len == 32);
39443         memcpy(val_ref.data, val->elems, 32); FREE(val);
39444         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
39445 }
39446
39447 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
39448         LDKTxAddOutput this_ptr_conv;
39449         this_ptr_conv.inner = untag_ptr(this_ptr);
39450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39452         this_ptr_conv.is_owned = false;
39453         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
39454         return ret_conv;
39455 }
39456
39457 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
39458         LDKTxAddOutput this_ptr_conv;
39459         this_ptr_conv.inner = untag_ptr(this_ptr);
39460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39462         this_ptr_conv.is_owned = false;
39463         TxAddOutput_set_serial_id(&this_ptr_conv, val);
39464 }
39465
39466 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
39467         LDKTxAddOutput this_ptr_conv;
39468         this_ptr_conv.inner = untag_ptr(this_ptr);
39469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39471         this_ptr_conv.is_owned = false;
39472         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
39473         return ret_conv;
39474 }
39475
39476 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
39477         LDKTxAddOutput this_ptr_conv;
39478         this_ptr_conv.inner = untag_ptr(this_ptr);
39479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39481         this_ptr_conv.is_owned = false;
39482         TxAddOutput_set_sats(&this_ptr_conv, val);
39483 }
39484
39485 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
39486         LDKTxAddOutput this_ptr_conv;
39487         this_ptr_conv.inner = untag_ptr(this_ptr);
39488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39490         this_ptr_conv.is_owned = false;
39491         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
39492         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39493         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39494         return ret_arr;
39495 }
39496
39497 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
39498         LDKTxAddOutput this_ptr_conv;
39499         this_ptr_conv.inner = untag_ptr(this_ptr);
39500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39502         this_ptr_conv.is_owned = false;
39503         LDKCVec_u8Z val_ref;
39504         val_ref.datalen = val->arr_len;
39505         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39506         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39507         TxAddOutput_set_script(&this_ptr_conv, val_ref);
39508 }
39509
39510 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) {
39511         LDKThirtyTwoBytes channel_id_arg_ref;
39512         CHECK(channel_id_arg->arr_len == 32);
39513         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39514         LDKCVec_u8Z script_arg_ref;
39515         script_arg_ref.datalen = script_arg->arr_len;
39516         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39517         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
39518         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
39519         uint64_t ret_ref = 0;
39520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39522         return ret_ref;
39523 }
39524
39525 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
39526         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
39527         uint64_t ret_ref = 0;
39528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39530         return ret_ref;
39531 }
39532 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
39533         LDKTxAddOutput arg_conv;
39534         arg_conv.inner = untag_ptr(arg);
39535         arg_conv.is_owned = ptr_is_owned(arg);
39536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39537         arg_conv.is_owned = false;
39538         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
39539         return ret_conv;
39540 }
39541
39542 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
39543         LDKTxAddOutput orig_conv;
39544         orig_conv.inner = untag_ptr(orig);
39545         orig_conv.is_owned = ptr_is_owned(orig);
39546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39547         orig_conv.is_owned = false;
39548         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
39549         uint64_t ret_ref = 0;
39550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39552         return ret_ref;
39553 }
39554
39555 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
39556         LDKTxAddOutput a_conv;
39557         a_conv.inner = untag_ptr(a);
39558         a_conv.is_owned = ptr_is_owned(a);
39559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39560         a_conv.is_owned = false;
39561         LDKTxAddOutput b_conv;
39562         b_conv.inner = untag_ptr(b);
39563         b_conv.is_owned = ptr_is_owned(b);
39564         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39565         b_conv.is_owned = false;
39566         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
39567         return ret_conv;
39568 }
39569
39570 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
39571         LDKTxRemoveInput this_obj_conv;
39572         this_obj_conv.inner = untag_ptr(this_obj);
39573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39575         TxRemoveInput_free(this_obj_conv);
39576 }
39577
39578 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
39579         LDKTxRemoveInput this_ptr_conv;
39580         this_ptr_conv.inner = untag_ptr(this_ptr);
39581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39583         this_ptr_conv.is_owned = false;
39584         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39585         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
39586         return ret_arr;
39587 }
39588
39589 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39590         LDKTxRemoveInput this_ptr_conv;
39591         this_ptr_conv.inner = untag_ptr(this_ptr);
39592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39594         this_ptr_conv.is_owned = false;
39595         LDKThirtyTwoBytes val_ref;
39596         CHECK(val->arr_len == 32);
39597         memcpy(val_ref.data, val->elems, 32); FREE(val);
39598         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
39599 }
39600
39601 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
39602         LDKTxRemoveInput this_ptr_conv;
39603         this_ptr_conv.inner = untag_ptr(this_ptr);
39604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39606         this_ptr_conv.is_owned = false;
39607         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
39608         return ret_conv;
39609 }
39610
39611 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
39612         LDKTxRemoveInput this_ptr_conv;
39613         this_ptr_conv.inner = untag_ptr(this_ptr);
39614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39616         this_ptr_conv.is_owned = false;
39617         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
39618 }
39619
39620 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
39621         LDKThirtyTwoBytes channel_id_arg_ref;
39622         CHECK(channel_id_arg->arr_len == 32);
39623         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39624         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
39625         uint64_t ret_ref = 0;
39626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39628         return ret_ref;
39629 }
39630
39631 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
39632         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
39633         uint64_t ret_ref = 0;
39634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39636         return ret_ref;
39637 }
39638 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
39639         LDKTxRemoveInput arg_conv;
39640         arg_conv.inner = untag_ptr(arg);
39641         arg_conv.is_owned = ptr_is_owned(arg);
39642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39643         arg_conv.is_owned = false;
39644         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
39645         return ret_conv;
39646 }
39647
39648 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
39649         LDKTxRemoveInput orig_conv;
39650         orig_conv.inner = untag_ptr(orig);
39651         orig_conv.is_owned = ptr_is_owned(orig);
39652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39653         orig_conv.is_owned = false;
39654         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
39655         uint64_t ret_ref = 0;
39656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39658         return ret_ref;
39659 }
39660
39661 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
39662         LDKTxRemoveInput a_conv;
39663         a_conv.inner = untag_ptr(a);
39664         a_conv.is_owned = ptr_is_owned(a);
39665         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39666         a_conv.is_owned = false;
39667         LDKTxRemoveInput b_conv;
39668         b_conv.inner = untag_ptr(b);
39669         b_conv.is_owned = ptr_is_owned(b);
39670         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39671         b_conv.is_owned = false;
39672         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
39673         return ret_conv;
39674 }
39675
39676 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
39677         LDKTxRemoveOutput this_obj_conv;
39678         this_obj_conv.inner = untag_ptr(this_obj);
39679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39681         TxRemoveOutput_free(this_obj_conv);
39682 }
39683
39684 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
39685         LDKTxRemoveOutput this_ptr_conv;
39686         this_ptr_conv.inner = untag_ptr(this_ptr);
39687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39689         this_ptr_conv.is_owned = false;
39690         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39691         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
39692         return ret_arr;
39693 }
39694
39695 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39696         LDKTxRemoveOutput this_ptr_conv;
39697         this_ptr_conv.inner = untag_ptr(this_ptr);
39698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39700         this_ptr_conv.is_owned = false;
39701         LDKThirtyTwoBytes val_ref;
39702         CHECK(val->arr_len == 32);
39703         memcpy(val_ref.data, val->elems, 32); FREE(val);
39704         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
39705 }
39706
39707 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
39708         LDKTxRemoveOutput this_ptr_conv;
39709         this_ptr_conv.inner = untag_ptr(this_ptr);
39710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39712         this_ptr_conv.is_owned = false;
39713         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
39714         return ret_conv;
39715 }
39716
39717 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
39718         LDKTxRemoveOutput this_ptr_conv;
39719         this_ptr_conv.inner = untag_ptr(this_ptr);
39720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39722         this_ptr_conv.is_owned = false;
39723         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
39724 }
39725
39726 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
39727         LDKThirtyTwoBytes channel_id_arg_ref;
39728         CHECK(channel_id_arg->arr_len == 32);
39729         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39730         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
39731         uint64_t ret_ref = 0;
39732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39734         return ret_ref;
39735 }
39736
39737 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
39738         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
39739         uint64_t ret_ref = 0;
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39742         return ret_ref;
39743 }
39744 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
39745         LDKTxRemoveOutput arg_conv;
39746         arg_conv.inner = untag_ptr(arg);
39747         arg_conv.is_owned = ptr_is_owned(arg);
39748         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39749         arg_conv.is_owned = false;
39750         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
39751         return ret_conv;
39752 }
39753
39754 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
39755         LDKTxRemoveOutput orig_conv;
39756         orig_conv.inner = untag_ptr(orig);
39757         orig_conv.is_owned = ptr_is_owned(orig);
39758         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39759         orig_conv.is_owned = false;
39760         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
39761         uint64_t ret_ref = 0;
39762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39764         return ret_ref;
39765 }
39766
39767 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
39768         LDKTxRemoveOutput a_conv;
39769         a_conv.inner = untag_ptr(a);
39770         a_conv.is_owned = ptr_is_owned(a);
39771         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39772         a_conv.is_owned = false;
39773         LDKTxRemoveOutput b_conv;
39774         b_conv.inner = untag_ptr(b);
39775         b_conv.is_owned = ptr_is_owned(b);
39776         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39777         b_conv.is_owned = false;
39778         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
39779         return ret_conv;
39780 }
39781
39782 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
39783         LDKTxComplete this_obj_conv;
39784         this_obj_conv.inner = untag_ptr(this_obj);
39785         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39787         TxComplete_free(this_obj_conv);
39788 }
39789
39790 int8_tArray  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
39791         LDKTxComplete this_ptr_conv;
39792         this_ptr_conv.inner = untag_ptr(this_ptr);
39793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39795         this_ptr_conv.is_owned = false;
39796         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39797         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
39798         return ret_arr;
39799 }
39800
39801 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39802         LDKTxComplete this_ptr_conv;
39803         this_ptr_conv.inner = untag_ptr(this_ptr);
39804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39806         this_ptr_conv.is_owned = false;
39807         LDKThirtyTwoBytes val_ref;
39808         CHECK(val->arr_len == 32);
39809         memcpy(val_ref.data, val->elems, 32); FREE(val);
39810         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
39811 }
39812
39813 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(int8_tArray channel_id_arg) {
39814         LDKThirtyTwoBytes channel_id_arg_ref;
39815         CHECK(channel_id_arg->arr_len == 32);
39816         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39817         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
39818         uint64_t ret_ref = 0;
39819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39821         return ret_ref;
39822 }
39823
39824 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
39825         LDKTxComplete ret_var = TxComplete_clone(arg);
39826         uint64_t ret_ref = 0;
39827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39829         return ret_ref;
39830 }
39831 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
39832         LDKTxComplete arg_conv;
39833         arg_conv.inner = untag_ptr(arg);
39834         arg_conv.is_owned = ptr_is_owned(arg);
39835         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39836         arg_conv.is_owned = false;
39837         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
39838         return ret_conv;
39839 }
39840
39841 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
39842         LDKTxComplete orig_conv;
39843         orig_conv.inner = untag_ptr(orig);
39844         orig_conv.is_owned = ptr_is_owned(orig);
39845         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39846         orig_conv.is_owned = false;
39847         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
39848         uint64_t ret_ref = 0;
39849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39851         return ret_ref;
39852 }
39853
39854 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
39855         LDKTxComplete a_conv;
39856         a_conv.inner = untag_ptr(a);
39857         a_conv.is_owned = ptr_is_owned(a);
39858         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39859         a_conv.is_owned = false;
39860         LDKTxComplete b_conv;
39861         b_conv.inner = untag_ptr(b);
39862         b_conv.is_owned = ptr_is_owned(b);
39863         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39864         b_conv.is_owned = false;
39865         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
39866         return ret_conv;
39867 }
39868
39869 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
39870         LDKTxSignatures this_obj_conv;
39871         this_obj_conv.inner = untag_ptr(this_obj);
39872         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39874         TxSignatures_free(this_obj_conv);
39875 }
39876
39877 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
39878         LDKTxSignatures this_ptr_conv;
39879         this_ptr_conv.inner = untag_ptr(this_ptr);
39880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39882         this_ptr_conv.is_owned = false;
39883         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39884         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
39885         return ret_arr;
39886 }
39887
39888 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39889         LDKTxSignatures this_ptr_conv;
39890         this_ptr_conv.inner = untag_ptr(this_ptr);
39891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39893         this_ptr_conv.is_owned = false;
39894         LDKThirtyTwoBytes val_ref;
39895         CHECK(val->arr_len == 32);
39896         memcpy(val_ref.data, val->elems, 32); FREE(val);
39897         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
39898 }
39899
39900 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
39901         LDKTxSignatures this_ptr_conv;
39902         this_ptr_conv.inner = untag_ptr(this_ptr);
39903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39905         this_ptr_conv.is_owned = false;
39906         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39907         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
39908         return ret_arr;
39909 }
39910
39911 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
39912         LDKTxSignatures this_ptr_conv;
39913         this_ptr_conv.inner = untag_ptr(this_ptr);
39914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39916         this_ptr_conv.is_owned = false;
39917         LDKThirtyTwoBytes val_ref;
39918         CHECK(val->arr_len == 32);
39919         memcpy(val_ref.data, val->elems, 32); FREE(val);
39920         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
39921 }
39922
39923 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
39924         LDKTxSignatures this_ptr_conv;
39925         this_ptr_conv.inner = untag_ptr(this_ptr);
39926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39928         this_ptr_conv.is_owned = false;
39929         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
39930         ptrArray ret_arr = NULL;
39931         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39932         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39933         for (size_t m = 0; m < ret_var.datalen; m++) {
39934                 LDKWitness ret_conv_12_var = ret_var.data[m];
39935                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
39936                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
39937                 Witness_free(ret_conv_12_var);
39938                 ret_arr_ptr[m] = ret_conv_12_arr;
39939         }
39940         
39941         FREE(ret_var.data);
39942         return ret_arr;
39943 }
39944
39945 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
39946         LDKTxSignatures this_ptr_conv;
39947         this_ptr_conv.inner = untag_ptr(this_ptr);
39948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39950         this_ptr_conv.is_owned = false;
39951         LDKCVec_WitnessZ val_constr;
39952         val_constr.datalen = val->arr_len;
39953         if (val_constr.datalen > 0)
39954                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
39955         else
39956                 val_constr.data = NULL;
39957         int8_tArray* val_vals = (void*) val->elems;
39958         for (size_t m = 0; m < val_constr.datalen; m++) {
39959                 int8_tArray val_conv_12 = val_vals[m];
39960                 LDKWitness val_conv_12_ref;
39961                 val_conv_12_ref.datalen = val_conv_12->arr_len;
39962                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
39963                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
39964                 val_conv_12_ref.data_is_owned = true;
39965                 val_constr.data[m] = val_conv_12_ref;
39966         }
39967         FREE(val);
39968         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
39969 }
39970
39971 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
39972         LDKThirtyTwoBytes channel_id_arg_ref;
39973         CHECK(channel_id_arg->arr_len == 32);
39974         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39975         LDKThirtyTwoBytes tx_hash_arg_ref;
39976         CHECK(tx_hash_arg->arr_len == 32);
39977         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
39978         LDKCVec_WitnessZ witnesses_arg_constr;
39979         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
39980         if (witnesses_arg_constr.datalen > 0)
39981                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
39982         else
39983                 witnesses_arg_constr.data = NULL;
39984         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
39985         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
39986                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
39987                 LDKWitness witnesses_arg_conv_12_ref;
39988                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
39989                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
39990                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
39991                 witnesses_arg_conv_12_ref.data_is_owned = true;
39992                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
39993         }
39994         FREE(witnesses_arg);
39995         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
39996         uint64_t ret_ref = 0;
39997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39999         return ret_ref;
40000 }
40001
40002 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
40003         LDKTxSignatures ret_var = TxSignatures_clone(arg);
40004         uint64_t ret_ref = 0;
40005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40007         return ret_ref;
40008 }
40009 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
40010         LDKTxSignatures arg_conv;
40011         arg_conv.inner = untag_ptr(arg);
40012         arg_conv.is_owned = ptr_is_owned(arg);
40013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40014         arg_conv.is_owned = false;
40015         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
40016         return ret_conv;
40017 }
40018
40019 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
40020         LDKTxSignatures orig_conv;
40021         orig_conv.inner = untag_ptr(orig);
40022         orig_conv.is_owned = ptr_is_owned(orig);
40023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40024         orig_conv.is_owned = false;
40025         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
40026         uint64_t ret_ref = 0;
40027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40029         return ret_ref;
40030 }
40031
40032 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
40033         LDKTxSignatures a_conv;
40034         a_conv.inner = untag_ptr(a);
40035         a_conv.is_owned = ptr_is_owned(a);
40036         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40037         a_conv.is_owned = false;
40038         LDKTxSignatures b_conv;
40039         b_conv.inner = untag_ptr(b);
40040         b_conv.is_owned = ptr_is_owned(b);
40041         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40042         b_conv.is_owned = false;
40043         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
40044         return ret_conv;
40045 }
40046
40047 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
40048         LDKTxInitRbf this_obj_conv;
40049         this_obj_conv.inner = untag_ptr(this_obj);
40050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40052         TxInitRbf_free(this_obj_conv);
40053 }
40054
40055 int8_tArray  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
40056         LDKTxInitRbf this_ptr_conv;
40057         this_ptr_conv.inner = untag_ptr(this_ptr);
40058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40060         this_ptr_conv.is_owned = false;
40061         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40062         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
40063         return ret_arr;
40064 }
40065
40066 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40067         LDKTxInitRbf this_ptr_conv;
40068         this_ptr_conv.inner = untag_ptr(this_ptr);
40069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40071         this_ptr_conv.is_owned = false;
40072         LDKThirtyTwoBytes val_ref;
40073         CHECK(val->arr_len == 32);
40074         memcpy(val_ref.data, val->elems, 32); FREE(val);
40075         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
40076 }
40077
40078 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
40079         LDKTxInitRbf this_ptr_conv;
40080         this_ptr_conv.inner = untag_ptr(this_ptr);
40081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40083         this_ptr_conv.is_owned = false;
40084         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
40085         return ret_conv;
40086 }
40087
40088 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
40089         LDKTxInitRbf this_ptr_conv;
40090         this_ptr_conv.inner = untag_ptr(this_ptr);
40091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40093         this_ptr_conv.is_owned = false;
40094         TxInitRbf_set_locktime(&this_ptr_conv, val);
40095 }
40096
40097 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) {
40098         LDKTxInitRbf this_ptr_conv;
40099         this_ptr_conv.inner = untag_ptr(this_ptr);
40100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40102         this_ptr_conv.is_owned = false;
40103         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
40104         return ret_conv;
40105 }
40106
40107 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) {
40108         LDKTxInitRbf this_ptr_conv;
40109         this_ptr_conv.inner = untag_ptr(this_ptr);
40110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40112         this_ptr_conv.is_owned = false;
40113         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
40114 }
40115
40116 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
40117         LDKTxInitRbf this_ptr_conv;
40118         this_ptr_conv.inner = untag_ptr(this_ptr);
40119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40121         this_ptr_conv.is_owned = false;
40122         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
40123         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
40124         uint64_t ret_ref = tag_ptr(ret_copy, true);
40125         return ret_ref;
40126 }
40127
40128 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
40129         LDKTxInitRbf this_ptr_conv;
40130         this_ptr_conv.inner = untag_ptr(this_ptr);
40131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40133         this_ptr_conv.is_owned = false;
40134         void* val_ptr = untag_ptr(val);
40135         CHECK_ACCESS(val_ptr);
40136         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
40137         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
40138         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
40139 }
40140
40141 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) {
40142         LDKThirtyTwoBytes channel_id_arg_ref;
40143         CHECK(channel_id_arg->arr_len == 32);
40144         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40145         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
40146         CHECK_ACCESS(funding_output_contribution_arg_ptr);
40147         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
40148         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
40149         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
40150         uint64_t ret_ref = 0;
40151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40153         return ret_ref;
40154 }
40155
40156 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
40157         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
40158         uint64_t ret_ref = 0;
40159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40161         return ret_ref;
40162 }
40163 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
40164         LDKTxInitRbf arg_conv;
40165         arg_conv.inner = untag_ptr(arg);
40166         arg_conv.is_owned = ptr_is_owned(arg);
40167         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40168         arg_conv.is_owned = false;
40169         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
40170         return ret_conv;
40171 }
40172
40173 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
40174         LDKTxInitRbf orig_conv;
40175         orig_conv.inner = untag_ptr(orig);
40176         orig_conv.is_owned = ptr_is_owned(orig);
40177         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40178         orig_conv.is_owned = false;
40179         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
40180         uint64_t ret_ref = 0;
40181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40183         return ret_ref;
40184 }
40185
40186 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
40187         LDKTxInitRbf a_conv;
40188         a_conv.inner = untag_ptr(a);
40189         a_conv.is_owned = ptr_is_owned(a);
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40191         a_conv.is_owned = false;
40192         LDKTxInitRbf b_conv;
40193         b_conv.inner = untag_ptr(b);
40194         b_conv.is_owned = ptr_is_owned(b);
40195         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40196         b_conv.is_owned = false;
40197         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
40198         return ret_conv;
40199 }
40200
40201 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
40202         LDKTxAckRbf this_obj_conv;
40203         this_obj_conv.inner = untag_ptr(this_obj);
40204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40206         TxAckRbf_free(this_obj_conv);
40207 }
40208
40209 int8_tArray  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
40210         LDKTxAckRbf this_ptr_conv;
40211         this_ptr_conv.inner = untag_ptr(this_ptr);
40212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40214         this_ptr_conv.is_owned = false;
40215         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40216         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
40217         return ret_arr;
40218 }
40219
40220 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40221         LDKTxAckRbf this_ptr_conv;
40222         this_ptr_conv.inner = untag_ptr(this_ptr);
40223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40225         this_ptr_conv.is_owned = false;
40226         LDKThirtyTwoBytes val_ref;
40227         CHECK(val->arr_len == 32);
40228         memcpy(val_ref.data, val->elems, 32); FREE(val);
40229         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
40230 }
40231
40232 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
40233         LDKTxAckRbf this_ptr_conv;
40234         this_ptr_conv.inner = untag_ptr(this_ptr);
40235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40237         this_ptr_conv.is_owned = false;
40238         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
40239         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
40240         uint64_t ret_ref = tag_ptr(ret_copy, true);
40241         return ret_ref;
40242 }
40243
40244 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
40245         LDKTxAckRbf this_ptr_conv;
40246         this_ptr_conv.inner = untag_ptr(this_ptr);
40247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40249         this_ptr_conv.is_owned = false;
40250         void* val_ptr = untag_ptr(val);
40251         CHECK_ACCESS(val_ptr);
40252         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
40253         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
40254         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
40255 }
40256
40257 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(int8_tArray channel_id_arg, uint64_t funding_output_contribution_arg) {
40258         LDKThirtyTwoBytes channel_id_arg_ref;
40259         CHECK(channel_id_arg->arr_len == 32);
40260         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40261         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
40262         CHECK_ACCESS(funding_output_contribution_arg_ptr);
40263         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
40264         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
40265         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
40266         uint64_t ret_ref = 0;
40267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40269         return ret_ref;
40270 }
40271
40272 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
40273         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
40274         uint64_t ret_ref = 0;
40275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40277         return ret_ref;
40278 }
40279 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
40280         LDKTxAckRbf arg_conv;
40281         arg_conv.inner = untag_ptr(arg);
40282         arg_conv.is_owned = ptr_is_owned(arg);
40283         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40284         arg_conv.is_owned = false;
40285         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
40286         return ret_conv;
40287 }
40288
40289 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
40290         LDKTxAckRbf orig_conv;
40291         orig_conv.inner = untag_ptr(orig);
40292         orig_conv.is_owned = ptr_is_owned(orig);
40293         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40294         orig_conv.is_owned = false;
40295         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
40296         uint64_t ret_ref = 0;
40297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40299         return ret_ref;
40300 }
40301
40302 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
40303         LDKTxAckRbf a_conv;
40304         a_conv.inner = untag_ptr(a);
40305         a_conv.is_owned = ptr_is_owned(a);
40306         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40307         a_conv.is_owned = false;
40308         LDKTxAckRbf b_conv;
40309         b_conv.inner = untag_ptr(b);
40310         b_conv.is_owned = ptr_is_owned(b);
40311         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40312         b_conv.is_owned = false;
40313         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
40314         return ret_conv;
40315 }
40316
40317 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
40318         LDKTxAbort this_obj_conv;
40319         this_obj_conv.inner = untag_ptr(this_obj);
40320         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40322         TxAbort_free(this_obj_conv);
40323 }
40324
40325 int8_tArray  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
40326         LDKTxAbort this_ptr_conv;
40327         this_ptr_conv.inner = untag_ptr(this_ptr);
40328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40330         this_ptr_conv.is_owned = false;
40331         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40332         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
40333         return ret_arr;
40334 }
40335
40336 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40337         LDKTxAbort this_ptr_conv;
40338         this_ptr_conv.inner = untag_ptr(this_ptr);
40339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40341         this_ptr_conv.is_owned = false;
40342         LDKThirtyTwoBytes val_ref;
40343         CHECK(val->arr_len == 32);
40344         memcpy(val_ref.data, val->elems, 32); FREE(val);
40345         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
40346 }
40347
40348 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
40349         LDKTxAbort this_ptr_conv;
40350         this_ptr_conv.inner = untag_ptr(this_ptr);
40351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40353         this_ptr_conv.is_owned = false;
40354         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
40355         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40356         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40357         CVec_u8Z_free(ret_var);
40358         return ret_arr;
40359 }
40360
40361 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
40362         LDKTxAbort this_ptr_conv;
40363         this_ptr_conv.inner = untag_ptr(this_ptr);
40364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40366         this_ptr_conv.is_owned = false;
40367         LDKCVec_u8Z val_ref;
40368         val_ref.datalen = val->arr_len;
40369         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40370         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40371         TxAbort_set_data(&this_ptr_conv, val_ref);
40372 }
40373
40374 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
40375         LDKThirtyTwoBytes channel_id_arg_ref;
40376         CHECK(channel_id_arg->arr_len == 32);
40377         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40378         LDKCVec_u8Z data_arg_ref;
40379         data_arg_ref.datalen = data_arg->arr_len;
40380         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40381         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
40382         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
40383         uint64_t ret_ref = 0;
40384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40386         return ret_ref;
40387 }
40388
40389 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
40390         LDKTxAbort ret_var = TxAbort_clone(arg);
40391         uint64_t ret_ref = 0;
40392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40394         return ret_ref;
40395 }
40396 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
40397         LDKTxAbort arg_conv;
40398         arg_conv.inner = untag_ptr(arg);
40399         arg_conv.is_owned = ptr_is_owned(arg);
40400         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40401         arg_conv.is_owned = false;
40402         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
40403         return ret_conv;
40404 }
40405
40406 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
40407         LDKTxAbort orig_conv;
40408         orig_conv.inner = untag_ptr(orig);
40409         orig_conv.is_owned = ptr_is_owned(orig);
40410         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40411         orig_conv.is_owned = false;
40412         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
40413         uint64_t ret_ref = 0;
40414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40416         return ret_ref;
40417 }
40418
40419 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
40420         LDKTxAbort a_conv;
40421         a_conv.inner = untag_ptr(a);
40422         a_conv.is_owned = ptr_is_owned(a);
40423         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40424         a_conv.is_owned = false;
40425         LDKTxAbort b_conv;
40426         b_conv.inner = untag_ptr(b);
40427         b_conv.is_owned = ptr_is_owned(b);
40428         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40429         b_conv.is_owned = false;
40430         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
40431         return ret_conv;
40432 }
40433
40434 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
40435         LDKShutdown this_obj_conv;
40436         this_obj_conv.inner = untag_ptr(this_obj);
40437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40439         Shutdown_free(this_obj_conv);
40440 }
40441
40442 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
40443         LDKShutdown this_ptr_conv;
40444         this_ptr_conv.inner = untag_ptr(this_ptr);
40445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40447         this_ptr_conv.is_owned = false;
40448         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40449         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
40450         return ret_arr;
40451 }
40452
40453 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40454         LDKShutdown this_ptr_conv;
40455         this_ptr_conv.inner = untag_ptr(this_ptr);
40456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40458         this_ptr_conv.is_owned = false;
40459         LDKThirtyTwoBytes val_ref;
40460         CHECK(val->arr_len == 32);
40461         memcpy(val_ref.data, val->elems, 32); FREE(val);
40462         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
40463 }
40464
40465 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
40466         LDKShutdown this_ptr_conv;
40467         this_ptr_conv.inner = untag_ptr(this_ptr);
40468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40470         this_ptr_conv.is_owned = false;
40471         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
40472         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40473         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40474         return ret_arr;
40475 }
40476
40477 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
40478         LDKShutdown 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_u8Z val_ref;
40484         val_ref.datalen = val->arr_len;
40485         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40486         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40487         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
40488 }
40489
40490 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
40491         LDKThirtyTwoBytes channel_id_arg_ref;
40492         CHECK(channel_id_arg->arr_len == 32);
40493         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40494         LDKCVec_u8Z scriptpubkey_arg_ref;
40495         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
40496         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40497         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
40498         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
40499         uint64_t ret_ref = 0;
40500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40502         return ret_ref;
40503 }
40504
40505 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
40506         LDKShutdown ret_var = Shutdown_clone(arg);
40507         uint64_t ret_ref = 0;
40508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40510         return ret_ref;
40511 }
40512 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
40513         LDKShutdown arg_conv;
40514         arg_conv.inner = untag_ptr(arg);
40515         arg_conv.is_owned = ptr_is_owned(arg);
40516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40517         arg_conv.is_owned = false;
40518         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
40519         return ret_conv;
40520 }
40521
40522 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
40523         LDKShutdown orig_conv;
40524         orig_conv.inner = untag_ptr(orig);
40525         orig_conv.is_owned = ptr_is_owned(orig);
40526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40527         orig_conv.is_owned = false;
40528         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
40529         uint64_t ret_ref = 0;
40530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40532         return ret_ref;
40533 }
40534
40535 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
40536         LDKShutdown a_conv;
40537         a_conv.inner = untag_ptr(a);
40538         a_conv.is_owned = ptr_is_owned(a);
40539         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40540         a_conv.is_owned = false;
40541         LDKShutdown b_conv;
40542         b_conv.inner = untag_ptr(b);
40543         b_conv.is_owned = ptr_is_owned(b);
40544         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40545         b_conv.is_owned = false;
40546         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
40547         return ret_conv;
40548 }
40549
40550 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
40551         LDKClosingSignedFeeRange this_obj_conv;
40552         this_obj_conv.inner = untag_ptr(this_obj);
40553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40555         ClosingSignedFeeRange_free(this_obj_conv);
40556 }
40557
40558 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
40559         LDKClosingSignedFeeRange this_ptr_conv;
40560         this_ptr_conv.inner = untag_ptr(this_ptr);
40561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40563         this_ptr_conv.is_owned = false;
40564         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
40565         return ret_conv;
40566 }
40567
40568 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
40569         LDKClosingSignedFeeRange this_ptr_conv;
40570         this_ptr_conv.inner = untag_ptr(this_ptr);
40571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40573         this_ptr_conv.is_owned = false;
40574         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
40575 }
40576
40577 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
40578         LDKClosingSignedFeeRange this_ptr_conv;
40579         this_ptr_conv.inner = untag_ptr(this_ptr);
40580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40582         this_ptr_conv.is_owned = false;
40583         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
40584         return ret_conv;
40585 }
40586
40587 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
40588         LDKClosingSignedFeeRange 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         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
40594 }
40595
40596 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
40597         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
40598         uint64_t ret_ref = 0;
40599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40601         return ret_ref;
40602 }
40603
40604 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
40605         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
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 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
40612         LDKClosingSignedFeeRange arg_conv;
40613         arg_conv.inner = untag_ptr(arg);
40614         arg_conv.is_owned = ptr_is_owned(arg);
40615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40616         arg_conv.is_owned = false;
40617         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
40618         return ret_conv;
40619 }
40620
40621 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
40622         LDKClosingSignedFeeRange orig_conv;
40623         orig_conv.inner = untag_ptr(orig);
40624         orig_conv.is_owned = ptr_is_owned(orig);
40625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40626         orig_conv.is_owned = false;
40627         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
40628         uint64_t ret_ref = 0;
40629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40631         return ret_ref;
40632 }
40633
40634 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
40635         LDKClosingSignedFeeRange a_conv;
40636         a_conv.inner = untag_ptr(a);
40637         a_conv.is_owned = ptr_is_owned(a);
40638         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40639         a_conv.is_owned = false;
40640         LDKClosingSignedFeeRange b_conv;
40641         b_conv.inner = untag_ptr(b);
40642         b_conv.is_owned = ptr_is_owned(b);
40643         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40644         b_conv.is_owned = false;
40645         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
40646         return ret_conv;
40647 }
40648
40649 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
40650         LDKClosingSigned this_obj_conv;
40651         this_obj_conv.inner = untag_ptr(this_obj);
40652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40654         ClosingSigned_free(this_obj_conv);
40655 }
40656
40657 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
40658         LDKClosingSigned this_ptr_conv;
40659         this_ptr_conv.inner = untag_ptr(this_ptr);
40660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40662         this_ptr_conv.is_owned = false;
40663         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40664         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
40665         return ret_arr;
40666 }
40667
40668 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40669         LDKClosingSigned this_ptr_conv;
40670         this_ptr_conv.inner = untag_ptr(this_ptr);
40671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40673         this_ptr_conv.is_owned = false;
40674         LDKThirtyTwoBytes val_ref;
40675         CHECK(val->arr_len == 32);
40676         memcpy(val_ref.data, val->elems, 32); FREE(val);
40677         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
40678 }
40679
40680 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
40681         LDKClosingSigned this_ptr_conv;
40682         this_ptr_conv.inner = untag_ptr(this_ptr);
40683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40685         this_ptr_conv.is_owned = false;
40686         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
40687         return ret_conv;
40688 }
40689
40690 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
40691         LDKClosingSigned this_ptr_conv;
40692         this_ptr_conv.inner = untag_ptr(this_ptr);
40693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40695         this_ptr_conv.is_owned = false;
40696         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
40697 }
40698
40699 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
40700         LDKClosingSigned this_ptr_conv;
40701         this_ptr_conv.inner = untag_ptr(this_ptr);
40702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40704         this_ptr_conv.is_owned = false;
40705         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40706         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
40707         return ret_arr;
40708 }
40709
40710 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
40711         LDKClosingSigned this_ptr_conv;
40712         this_ptr_conv.inner = untag_ptr(this_ptr);
40713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40715         this_ptr_conv.is_owned = false;
40716         LDKECDSASignature val_ref;
40717         CHECK(val->arr_len == 64);
40718         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40719         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
40720 }
40721
40722 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
40723         LDKClosingSigned 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         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
40729         uint64_t ret_ref = 0;
40730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40732         return ret_ref;
40733 }
40734
40735 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
40736         LDKClosingSigned this_ptr_conv;
40737         this_ptr_conv.inner = untag_ptr(this_ptr);
40738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40740         this_ptr_conv.is_owned = false;
40741         LDKClosingSignedFeeRange val_conv;
40742         val_conv.inner = untag_ptr(val);
40743         val_conv.is_owned = ptr_is_owned(val);
40744         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40745         val_conv = ClosingSignedFeeRange_clone(&val_conv);
40746         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
40747 }
40748
40749 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) {
40750         LDKThirtyTwoBytes channel_id_arg_ref;
40751         CHECK(channel_id_arg->arr_len == 32);
40752         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40753         LDKECDSASignature signature_arg_ref;
40754         CHECK(signature_arg->arr_len == 64);
40755         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
40756         LDKClosingSignedFeeRange fee_range_arg_conv;
40757         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
40758         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
40759         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
40760         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
40761         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
40762         uint64_t ret_ref = 0;
40763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40765         return ret_ref;
40766 }
40767
40768 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
40769         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
40770         uint64_t ret_ref = 0;
40771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40773         return ret_ref;
40774 }
40775 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
40776         LDKClosingSigned arg_conv;
40777         arg_conv.inner = untag_ptr(arg);
40778         arg_conv.is_owned = ptr_is_owned(arg);
40779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40780         arg_conv.is_owned = false;
40781         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
40782         return ret_conv;
40783 }
40784
40785 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
40786         LDKClosingSigned orig_conv;
40787         orig_conv.inner = untag_ptr(orig);
40788         orig_conv.is_owned = ptr_is_owned(orig);
40789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40790         orig_conv.is_owned = false;
40791         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
40792         uint64_t ret_ref = 0;
40793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40795         return ret_ref;
40796 }
40797
40798 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
40799         LDKClosingSigned a_conv;
40800         a_conv.inner = untag_ptr(a);
40801         a_conv.is_owned = ptr_is_owned(a);
40802         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40803         a_conv.is_owned = false;
40804         LDKClosingSigned b_conv;
40805         b_conv.inner = untag_ptr(b);
40806         b_conv.is_owned = ptr_is_owned(b);
40807         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40808         b_conv.is_owned = false;
40809         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
40810         return ret_conv;
40811 }
40812
40813 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
40814         LDKUpdateAddHTLC this_obj_conv;
40815         this_obj_conv.inner = untag_ptr(this_obj);
40816         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40818         UpdateAddHTLC_free(this_obj_conv);
40819 }
40820
40821 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
40822         LDKUpdateAddHTLC this_ptr_conv;
40823         this_ptr_conv.inner = untag_ptr(this_ptr);
40824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40826         this_ptr_conv.is_owned = false;
40827         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40828         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
40829         return ret_arr;
40830 }
40831
40832 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40833         LDKUpdateAddHTLC this_ptr_conv;
40834         this_ptr_conv.inner = untag_ptr(this_ptr);
40835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40837         this_ptr_conv.is_owned = false;
40838         LDKThirtyTwoBytes val_ref;
40839         CHECK(val->arr_len == 32);
40840         memcpy(val_ref.data, val->elems, 32); FREE(val);
40841         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
40842 }
40843
40844 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
40845         LDKUpdateAddHTLC this_ptr_conv;
40846         this_ptr_conv.inner = untag_ptr(this_ptr);
40847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40849         this_ptr_conv.is_owned = false;
40850         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
40851         return ret_conv;
40852 }
40853
40854 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
40855         LDKUpdateAddHTLC this_ptr_conv;
40856         this_ptr_conv.inner = untag_ptr(this_ptr);
40857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40859         this_ptr_conv.is_owned = false;
40860         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
40861 }
40862
40863 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
40864         LDKUpdateAddHTLC this_ptr_conv;
40865         this_ptr_conv.inner = untag_ptr(this_ptr);
40866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40868         this_ptr_conv.is_owned = false;
40869         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
40870         return ret_conv;
40871 }
40872
40873 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
40874         LDKUpdateAddHTLC this_ptr_conv;
40875         this_ptr_conv.inner = untag_ptr(this_ptr);
40876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40878         this_ptr_conv.is_owned = false;
40879         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
40880 }
40881
40882 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
40883         LDKUpdateAddHTLC this_ptr_conv;
40884         this_ptr_conv.inner = untag_ptr(this_ptr);
40885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40887         this_ptr_conv.is_owned = false;
40888         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40889         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
40890         return ret_arr;
40891 }
40892
40893 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
40894         LDKUpdateAddHTLC this_ptr_conv;
40895         this_ptr_conv.inner = untag_ptr(this_ptr);
40896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40898         this_ptr_conv.is_owned = false;
40899         LDKThirtyTwoBytes val_ref;
40900         CHECK(val->arr_len == 32);
40901         memcpy(val_ref.data, val->elems, 32); FREE(val);
40902         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
40903 }
40904
40905 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
40906         LDKUpdateAddHTLC this_ptr_conv;
40907         this_ptr_conv.inner = untag_ptr(this_ptr);
40908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40910         this_ptr_conv.is_owned = false;
40911         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
40912         return ret_conv;
40913 }
40914
40915 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
40916         LDKUpdateAddHTLC this_ptr_conv;
40917         this_ptr_conv.inner = untag_ptr(this_ptr);
40918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40920         this_ptr_conv.is_owned = false;
40921         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
40922 }
40923
40924 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
40925         LDKUpdateAddHTLC this_ptr_conv;
40926         this_ptr_conv.inner = untag_ptr(this_ptr);
40927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40929         this_ptr_conv.is_owned = false;
40930         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40931         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
40932         uint64_t ret_ref = tag_ptr(ret_copy, true);
40933         return ret_ref;
40934 }
40935
40936 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
40937         LDKUpdateAddHTLC 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         void* val_ptr = untag_ptr(val);
40943         CHECK_ACCESS(val_ptr);
40944         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40945         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40946         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
40947 }
40948
40949 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
40950         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
40951         uint64_t ret_ref = 0;
40952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40954         return ret_ref;
40955 }
40956 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
40957         LDKUpdateAddHTLC arg_conv;
40958         arg_conv.inner = untag_ptr(arg);
40959         arg_conv.is_owned = ptr_is_owned(arg);
40960         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40961         arg_conv.is_owned = false;
40962         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
40963         return ret_conv;
40964 }
40965
40966 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
40967         LDKUpdateAddHTLC orig_conv;
40968         orig_conv.inner = untag_ptr(orig);
40969         orig_conv.is_owned = ptr_is_owned(orig);
40970         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40971         orig_conv.is_owned = false;
40972         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
40973         uint64_t ret_ref = 0;
40974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40976         return ret_ref;
40977 }
40978
40979 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
40980         LDKUpdateAddHTLC a_conv;
40981         a_conv.inner = untag_ptr(a);
40982         a_conv.is_owned = ptr_is_owned(a);
40983         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40984         a_conv.is_owned = false;
40985         LDKUpdateAddHTLC b_conv;
40986         b_conv.inner = untag_ptr(b);
40987         b_conv.is_owned = ptr_is_owned(b);
40988         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40989         b_conv.is_owned = false;
40990         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
40991         return ret_conv;
40992 }
40993
40994 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
40995         LDKOnionMessage this_obj_conv;
40996         this_obj_conv.inner = untag_ptr(this_obj);
40997         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40999         OnionMessage_free(this_obj_conv);
41000 }
41001
41002 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
41003         LDKOnionMessage this_ptr_conv;
41004         this_ptr_conv.inner = untag_ptr(this_ptr);
41005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41007         this_ptr_conv.is_owned = false;
41008         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41009         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
41010         return ret_arr;
41011 }
41012
41013 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
41014         LDKOnionMessage this_ptr_conv;
41015         this_ptr_conv.inner = untag_ptr(this_ptr);
41016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41018         this_ptr_conv.is_owned = false;
41019         LDKPublicKey val_ref;
41020         CHECK(val->arr_len == 33);
41021         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41022         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
41023 }
41024
41025 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
41026         LDKOnionMessage this_ptr_conv;
41027         this_ptr_conv.inner = untag_ptr(this_ptr);
41028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41030         this_ptr_conv.is_owned = false;
41031         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
41032         uint64_t ret_ref = 0;
41033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41035         return ret_ref;
41036 }
41037
41038 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
41039         LDKOnionMessage this_ptr_conv;
41040         this_ptr_conv.inner = untag_ptr(this_ptr);
41041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41043         this_ptr_conv.is_owned = false;
41044         LDKPacket val_conv;
41045         val_conv.inner = untag_ptr(val);
41046         val_conv.is_owned = ptr_is_owned(val);
41047         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41048         val_conv = Packet_clone(&val_conv);
41049         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
41050 }
41051
41052 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
41053         LDKPublicKey blinding_point_arg_ref;
41054         CHECK(blinding_point_arg->arr_len == 33);
41055         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
41056         LDKPacket onion_routing_packet_arg_conv;
41057         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
41058         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
41059         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
41060         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
41061         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
41062         uint64_t ret_ref = 0;
41063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41065         return ret_ref;
41066 }
41067
41068 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
41069         LDKOnionMessage ret_var = OnionMessage_clone(arg);
41070         uint64_t ret_ref = 0;
41071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41073         return ret_ref;
41074 }
41075 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
41076         LDKOnionMessage arg_conv;
41077         arg_conv.inner = untag_ptr(arg);
41078         arg_conv.is_owned = ptr_is_owned(arg);
41079         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41080         arg_conv.is_owned = false;
41081         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
41082         return ret_conv;
41083 }
41084
41085 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
41086         LDKOnionMessage orig_conv;
41087         orig_conv.inner = untag_ptr(orig);
41088         orig_conv.is_owned = ptr_is_owned(orig);
41089         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41090         orig_conv.is_owned = false;
41091         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
41092         uint64_t ret_ref = 0;
41093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41095         return ret_ref;
41096 }
41097
41098 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
41099         LDKOnionMessage a_conv;
41100         a_conv.inner = untag_ptr(a);
41101         a_conv.is_owned = ptr_is_owned(a);
41102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41103         a_conv.is_owned = false;
41104         LDKOnionMessage b_conv;
41105         b_conv.inner = untag_ptr(b);
41106         b_conv.is_owned = ptr_is_owned(b);
41107         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41108         b_conv.is_owned = false;
41109         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
41110         return ret_conv;
41111 }
41112
41113 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
41114         LDKUpdateFulfillHTLC this_obj_conv;
41115         this_obj_conv.inner = untag_ptr(this_obj);
41116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41118         UpdateFulfillHTLC_free(this_obj_conv);
41119 }
41120
41121 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
41122         LDKUpdateFulfillHTLC this_ptr_conv;
41123         this_ptr_conv.inner = untag_ptr(this_ptr);
41124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41126         this_ptr_conv.is_owned = false;
41127         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41128         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
41129         return ret_arr;
41130 }
41131
41132 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41133         LDKUpdateFulfillHTLC this_ptr_conv;
41134         this_ptr_conv.inner = untag_ptr(this_ptr);
41135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41137         this_ptr_conv.is_owned = false;
41138         LDKThirtyTwoBytes val_ref;
41139         CHECK(val->arr_len == 32);
41140         memcpy(val_ref.data, val->elems, 32); FREE(val);
41141         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
41142 }
41143
41144 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
41145         LDKUpdateFulfillHTLC this_ptr_conv;
41146         this_ptr_conv.inner = untag_ptr(this_ptr);
41147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41149         this_ptr_conv.is_owned = false;
41150         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
41151         return ret_conv;
41152 }
41153
41154 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41155         LDKUpdateFulfillHTLC this_ptr_conv;
41156         this_ptr_conv.inner = untag_ptr(this_ptr);
41157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41159         this_ptr_conv.is_owned = false;
41160         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
41161 }
41162
41163 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
41164         LDKUpdateFulfillHTLC this_ptr_conv;
41165         this_ptr_conv.inner = untag_ptr(this_ptr);
41166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41168         this_ptr_conv.is_owned = false;
41169         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41170         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
41171         return ret_arr;
41172 }
41173
41174 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
41175         LDKUpdateFulfillHTLC 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         LDKThirtyTwoBytes val_ref;
41181         CHECK(val->arr_len == 32);
41182         memcpy(val_ref.data, val->elems, 32); FREE(val);
41183         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
41184 }
41185
41186 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) {
41187         LDKThirtyTwoBytes channel_id_arg_ref;
41188         CHECK(channel_id_arg->arr_len == 32);
41189         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41190         LDKThirtyTwoBytes payment_preimage_arg_ref;
41191         CHECK(payment_preimage_arg->arr_len == 32);
41192         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
41193         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
41194         uint64_t ret_ref = 0;
41195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41197         return ret_ref;
41198 }
41199
41200 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
41201         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
41202         uint64_t ret_ref = 0;
41203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41205         return ret_ref;
41206 }
41207 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
41208         LDKUpdateFulfillHTLC arg_conv;
41209         arg_conv.inner = untag_ptr(arg);
41210         arg_conv.is_owned = ptr_is_owned(arg);
41211         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41212         arg_conv.is_owned = false;
41213         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
41214         return ret_conv;
41215 }
41216
41217 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
41218         LDKUpdateFulfillHTLC orig_conv;
41219         orig_conv.inner = untag_ptr(orig);
41220         orig_conv.is_owned = ptr_is_owned(orig);
41221         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41222         orig_conv.is_owned = false;
41223         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
41224         uint64_t ret_ref = 0;
41225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41227         return ret_ref;
41228 }
41229
41230 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
41231         LDKUpdateFulfillHTLC a_conv;
41232         a_conv.inner = untag_ptr(a);
41233         a_conv.is_owned = ptr_is_owned(a);
41234         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41235         a_conv.is_owned = false;
41236         LDKUpdateFulfillHTLC b_conv;
41237         b_conv.inner = untag_ptr(b);
41238         b_conv.is_owned = ptr_is_owned(b);
41239         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41240         b_conv.is_owned = false;
41241         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
41242         return ret_conv;
41243 }
41244
41245 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
41246         LDKUpdateFailHTLC this_obj_conv;
41247         this_obj_conv.inner = untag_ptr(this_obj);
41248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41250         UpdateFailHTLC_free(this_obj_conv);
41251 }
41252
41253 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
41254         LDKUpdateFailHTLC this_ptr_conv;
41255         this_ptr_conv.inner = untag_ptr(this_ptr);
41256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41258         this_ptr_conv.is_owned = false;
41259         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41260         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
41261         return ret_arr;
41262 }
41263
41264 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41265         LDKUpdateFailHTLC this_ptr_conv;
41266         this_ptr_conv.inner = untag_ptr(this_ptr);
41267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41269         this_ptr_conv.is_owned = false;
41270         LDKThirtyTwoBytes val_ref;
41271         CHECK(val->arr_len == 32);
41272         memcpy(val_ref.data, val->elems, 32); FREE(val);
41273         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
41274 }
41275
41276 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
41277         LDKUpdateFailHTLC this_ptr_conv;
41278         this_ptr_conv.inner = untag_ptr(this_ptr);
41279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41281         this_ptr_conv.is_owned = false;
41282         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
41283         return ret_conv;
41284 }
41285
41286 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41287         LDKUpdateFailHTLC this_ptr_conv;
41288         this_ptr_conv.inner = untag_ptr(this_ptr);
41289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41291         this_ptr_conv.is_owned = false;
41292         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
41293 }
41294
41295 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
41296         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
41297         uint64_t ret_ref = 0;
41298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41300         return ret_ref;
41301 }
41302 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
41303         LDKUpdateFailHTLC arg_conv;
41304         arg_conv.inner = untag_ptr(arg);
41305         arg_conv.is_owned = ptr_is_owned(arg);
41306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41307         arg_conv.is_owned = false;
41308         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
41309         return ret_conv;
41310 }
41311
41312 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
41313         LDKUpdateFailHTLC orig_conv;
41314         orig_conv.inner = untag_ptr(orig);
41315         orig_conv.is_owned = ptr_is_owned(orig);
41316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41317         orig_conv.is_owned = false;
41318         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
41319         uint64_t ret_ref = 0;
41320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41322         return ret_ref;
41323 }
41324
41325 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
41326         LDKUpdateFailHTLC a_conv;
41327         a_conv.inner = untag_ptr(a);
41328         a_conv.is_owned = ptr_is_owned(a);
41329         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41330         a_conv.is_owned = false;
41331         LDKUpdateFailHTLC b_conv;
41332         b_conv.inner = untag_ptr(b);
41333         b_conv.is_owned = ptr_is_owned(b);
41334         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41335         b_conv.is_owned = false;
41336         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
41337         return ret_conv;
41338 }
41339
41340 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
41341         LDKUpdateFailMalformedHTLC this_obj_conv;
41342         this_obj_conv.inner = untag_ptr(this_obj);
41343         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41345         UpdateFailMalformedHTLC_free(this_obj_conv);
41346 }
41347
41348 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
41349         LDKUpdateFailMalformedHTLC this_ptr_conv;
41350         this_ptr_conv.inner = untag_ptr(this_ptr);
41351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41353         this_ptr_conv.is_owned = false;
41354         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41355         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
41356         return ret_arr;
41357 }
41358
41359 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41360         LDKUpdateFailMalformedHTLC this_ptr_conv;
41361         this_ptr_conv.inner = untag_ptr(this_ptr);
41362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41364         this_ptr_conv.is_owned = false;
41365         LDKThirtyTwoBytes val_ref;
41366         CHECK(val->arr_len == 32);
41367         memcpy(val_ref.data, val->elems, 32); FREE(val);
41368         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
41369 }
41370
41371 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
41372         LDKUpdateFailMalformedHTLC this_ptr_conv;
41373         this_ptr_conv.inner = untag_ptr(this_ptr);
41374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41376         this_ptr_conv.is_owned = false;
41377         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
41378         return ret_conv;
41379 }
41380
41381 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41382         LDKUpdateFailMalformedHTLC this_ptr_conv;
41383         this_ptr_conv.inner = untag_ptr(this_ptr);
41384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41386         this_ptr_conv.is_owned = false;
41387         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
41388 }
41389
41390 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
41391         LDKUpdateFailMalformedHTLC this_ptr_conv;
41392         this_ptr_conv.inner = untag_ptr(this_ptr);
41393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41395         this_ptr_conv.is_owned = false;
41396         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
41397         return ret_conv;
41398 }
41399
41400 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
41401         LDKUpdateFailMalformedHTLC this_ptr_conv;
41402         this_ptr_conv.inner = untag_ptr(this_ptr);
41403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41405         this_ptr_conv.is_owned = false;
41406         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
41407 }
41408
41409 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
41410         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
41411         uint64_t ret_ref = 0;
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41414         return ret_ref;
41415 }
41416 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
41417         LDKUpdateFailMalformedHTLC arg_conv;
41418         arg_conv.inner = untag_ptr(arg);
41419         arg_conv.is_owned = ptr_is_owned(arg);
41420         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41421         arg_conv.is_owned = false;
41422         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
41423         return ret_conv;
41424 }
41425
41426 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
41427         LDKUpdateFailMalformedHTLC orig_conv;
41428         orig_conv.inner = untag_ptr(orig);
41429         orig_conv.is_owned = ptr_is_owned(orig);
41430         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41431         orig_conv.is_owned = false;
41432         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
41433         uint64_t ret_ref = 0;
41434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41436         return ret_ref;
41437 }
41438
41439 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
41440         LDKUpdateFailMalformedHTLC a_conv;
41441         a_conv.inner = untag_ptr(a);
41442         a_conv.is_owned = ptr_is_owned(a);
41443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41444         a_conv.is_owned = false;
41445         LDKUpdateFailMalformedHTLC b_conv;
41446         b_conv.inner = untag_ptr(b);
41447         b_conv.is_owned = ptr_is_owned(b);
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41449         b_conv.is_owned = false;
41450         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
41451         return ret_conv;
41452 }
41453
41454 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
41455         LDKCommitmentSigned this_obj_conv;
41456         this_obj_conv.inner = untag_ptr(this_obj);
41457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41459         CommitmentSigned_free(this_obj_conv);
41460 }
41461
41462 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
41463         LDKCommitmentSigned this_ptr_conv;
41464         this_ptr_conv.inner = untag_ptr(this_ptr);
41465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41467         this_ptr_conv.is_owned = false;
41468         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41469         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
41470         return ret_arr;
41471 }
41472
41473 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41474         LDKCommitmentSigned this_ptr_conv;
41475         this_ptr_conv.inner = untag_ptr(this_ptr);
41476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41478         this_ptr_conv.is_owned = false;
41479         LDKThirtyTwoBytes val_ref;
41480         CHECK(val->arr_len == 32);
41481         memcpy(val_ref.data, val->elems, 32); FREE(val);
41482         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
41483 }
41484
41485 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
41486         LDKCommitmentSigned this_ptr_conv;
41487         this_ptr_conv.inner = untag_ptr(this_ptr);
41488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41490         this_ptr_conv.is_owned = false;
41491         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
41492         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
41493         return ret_arr;
41494 }
41495
41496 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
41497         LDKCommitmentSigned this_ptr_conv;
41498         this_ptr_conv.inner = untag_ptr(this_ptr);
41499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41501         this_ptr_conv.is_owned = false;
41502         LDKECDSASignature val_ref;
41503         CHECK(val->arr_len == 64);
41504         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
41505         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
41506 }
41507
41508 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
41509         LDKCommitmentSigned this_ptr_conv;
41510         this_ptr_conv.inner = untag_ptr(this_ptr);
41511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41513         this_ptr_conv.is_owned = false;
41514         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
41515         ptrArray ret_arr = NULL;
41516         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
41517         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
41518         for (size_t m = 0; m < ret_var.datalen; m++) {
41519                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
41520                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
41521                 ret_arr_ptr[m] = ret_conv_12_arr;
41522         }
41523         
41524         FREE(ret_var.data);
41525         return ret_arr;
41526 }
41527
41528 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
41529         LDKCommitmentSigned this_ptr_conv;
41530         this_ptr_conv.inner = untag_ptr(this_ptr);
41531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41533         this_ptr_conv.is_owned = false;
41534         LDKCVec_ECDSASignatureZ val_constr;
41535         val_constr.datalen = val->arr_len;
41536         if (val_constr.datalen > 0)
41537                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
41538         else
41539                 val_constr.data = NULL;
41540         int8_tArray* val_vals = (void*) val->elems;
41541         for (size_t m = 0; m < val_constr.datalen; m++) {
41542                 int8_tArray val_conv_12 = val_vals[m];
41543                 LDKECDSASignature val_conv_12_ref;
41544                 CHECK(val_conv_12->arr_len == 64);
41545                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
41546                 val_constr.data[m] = val_conv_12_ref;
41547         }
41548         FREE(val);
41549         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
41550 }
41551
41552 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
41553         LDKThirtyTwoBytes channel_id_arg_ref;
41554         CHECK(channel_id_arg->arr_len == 32);
41555         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41556         LDKECDSASignature signature_arg_ref;
41557         CHECK(signature_arg->arr_len == 64);
41558         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
41559         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
41560         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
41561         if (htlc_signatures_arg_constr.datalen > 0)
41562                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
41563         else
41564                 htlc_signatures_arg_constr.data = NULL;
41565         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
41566         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
41567                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
41568                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
41569                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
41570                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
41571                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
41572         }
41573         FREE(htlc_signatures_arg);
41574         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
41575         uint64_t ret_ref = 0;
41576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41578         return ret_ref;
41579 }
41580
41581 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
41582         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
41583         uint64_t ret_ref = 0;
41584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41586         return ret_ref;
41587 }
41588 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
41589         LDKCommitmentSigned arg_conv;
41590         arg_conv.inner = untag_ptr(arg);
41591         arg_conv.is_owned = ptr_is_owned(arg);
41592         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41593         arg_conv.is_owned = false;
41594         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
41595         return ret_conv;
41596 }
41597
41598 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
41599         LDKCommitmentSigned orig_conv;
41600         orig_conv.inner = untag_ptr(orig);
41601         orig_conv.is_owned = ptr_is_owned(orig);
41602         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41603         orig_conv.is_owned = false;
41604         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
41605         uint64_t ret_ref = 0;
41606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41608         return ret_ref;
41609 }
41610
41611 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
41612         LDKCommitmentSigned a_conv;
41613         a_conv.inner = untag_ptr(a);
41614         a_conv.is_owned = ptr_is_owned(a);
41615         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41616         a_conv.is_owned = false;
41617         LDKCommitmentSigned b_conv;
41618         b_conv.inner = untag_ptr(b);
41619         b_conv.is_owned = ptr_is_owned(b);
41620         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41621         b_conv.is_owned = false;
41622         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
41623         return ret_conv;
41624 }
41625
41626 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
41627         LDKRevokeAndACK this_obj_conv;
41628         this_obj_conv.inner = untag_ptr(this_obj);
41629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41631         RevokeAndACK_free(this_obj_conv);
41632 }
41633
41634 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
41635         LDKRevokeAndACK this_ptr_conv;
41636         this_ptr_conv.inner = untag_ptr(this_ptr);
41637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41639         this_ptr_conv.is_owned = false;
41640         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41641         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
41642         return ret_arr;
41643 }
41644
41645 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41646         LDKRevokeAndACK this_ptr_conv;
41647         this_ptr_conv.inner = untag_ptr(this_ptr);
41648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41650         this_ptr_conv.is_owned = false;
41651         LDKThirtyTwoBytes val_ref;
41652         CHECK(val->arr_len == 32);
41653         memcpy(val_ref.data, val->elems, 32); FREE(val);
41654         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
41655 }
41656
41657 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
41658         LDKRevokeAndACK this_ptr_conv;
41659         this_ptr_conv.inner = untag_ptr(this_ptr);
41660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41662         this_ptr_conv.is_owned = false;
41663         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41664         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
41665         return ret_arr;
41666 }
41667
41668 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
41669         LDKRevokeAndACK 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         LDKThirtyTwoBytes val_ref;
41675         CHECK(val->arr_len == 32);
41676         memcpy(val_ref.data, val->elems, 32); FREE(val);
41677         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
41678 }
41679
41680 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
41681         LDKRevokeAndACK this_ptr_conv;
41682         this_ptr_conv.inner = untag_ptr(this_ptr);
41683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41685         this_ptr_conv.is_owned = false;
41686         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41687         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
41688         return ret_arr;
41689 }
41690
41691 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) {
41692         LDKRevokeAndACK this_ptr_conv;
41693         this_ptr_conv.inner = untag_ptr(this_ptr);
41694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41696         this_ptr_conv.is_owned = false;
41697         LDKPublicKey val_ref;
41698         CHECK(val->arr_len == 33);
41699         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41700         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
41701 }
41702
41703 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) {
41704         LDKThirtyTwoBytes channel_id_arg_ref;
41705         CHECK(channel_id_arg->arr_len == 32);
41706         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41707         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
41708         CHECK(per_commitment_secret_arg->arr_len == 32);
41709         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
41710         LDKPublicKey next_per_commitment_point_arg_ref;
41711         CHECK(next_per_commitment_point_arg->arr_len == 33);
41712         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
41713         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
41714         uint64_t ret_ref = 0;
41715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41717         return ret_ref;
41718 }
41719
41720 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
41721         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
41722         uint64_t ret_ref = 0;
41723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41725         return ret_ref;
41726 }
41727 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
41728         LDKRevokeAndACK arg_conv;
41729         arg_conv.inner = untag_ptr(arg);
41730         arg_conv.is_owned = ptr_is_owned(arg);
41731         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41732         arg_conv.is_owned = false;
41733         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
41734         return ret_conv;
41735 }
41736
41737 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
41738         LDKRevokeAndACK orig_conv;
41739         orig_conv.inner = untag_ptr(orig);
41740         orig_conv.is_owned = ptr_is_owned(orig);
41741         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41742         orig_conv.is_owned = false;
41743         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
41744         uint64_t ret_ref = 0;
41745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41747         return ret_ref;
41748 }
41749
41750 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
41751         LDKRevokeAndACK a_conv;
41752         a_conv.inner = untag_ptr(a);
41753         a_conv.is_owned = ptr_is_owned(a);
41754         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41755         a_conv.is_owned = false;
41756         LDKRevokeAndACK b_conv;
41757         b_conv.inner = untag_ptr(b);
41758         b_conv.is_owned = ptr_is_owned(b);
41759         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41760         b_conv.is_owned = false;
41761         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
41762         return ret_conv;
41763 }
41764
41765 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
41766         LDKUpdateFee this_obj_conv;
41767         this_obj_conv.inner = untag_ptr(this_obj);
41768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41770         UpdateFee_free(this_obj_conv);
41771 }
41772
41773 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
41774         LDKUpdateFee this_ptr_conv;
41775         this_ptr_conv.inner = untag_ptr(this_ptr);
41776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41778         this_ptr_conv.is_owned = false;
41779         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41780         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
41781         return ret_arr;
41782 }
41783
41784 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41785         LDKUpdateFee this_ptr_conv;
41786         this_ptr_conv.inner = untag_ptr(this_ptr);
41787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41789         this_ptr_conv.is_owned = false;
41790         LDKThirtyTwoBytes val_ref;
41791         CHECK(val->arr_len == 32);
41792         memcpy(val_ref.data, val->elems, 32); FREE(val);
41793         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
41794 }
41795
41796 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
41797         LDKUpdateFee this_ptr_conv;
41798         this_ptr_conv.inner = untag_ptr(this_ptr);
41799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41801         this_ptr_conv.is_owned = false;
41802         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
41803         return ret_conv;
41804 }
41805
41806 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
41807         LDKUpdateFee this_ptr_conv;
41808         this_ptr_conv.inner = untag_ptr(this_ptr);
41809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41811         this_ptr_conv.is_owned = false;
41812         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
41813 }
41814
41815 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
41816         LDKThirtyTwoBytes channel_id_arg_ref;
41817         CHECK(channel_id_arg->arr_len == 32);
41818         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41819         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
41820         uint64_t ret_ref = 0;
41821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41823         return ret_ref;
41824 }
41825
41826 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
41827         LDKUpdateFee ret_var = UpdateFee_clone(arg);
41828         uint64_t ret_ref = 0;
41829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41831         return ret_ref;
41832 }
41833 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
41834         LDKUpdateFee arg_conv;
41835         arg_conv.inner = untag_ptr(arg);
41836         arg_conv.is_owned = ptr_is_owned(arg);
41837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41838         arg_conv.is_owned = false;
41839         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
41840         return ret_conv;
41841 }
41842
41843 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
41844         LDKUpdateFee orig_conv;
41845         orig_conv.inner = untag_ptr(orig);
41846         orig_conv.is_owned = ptr_is_owned(orig);
41847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41848         orig_conv.is_owned = false;
41849         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
41850         uint64_t ret_ref = 0;
41851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41853         return ret_ref;
41854 }
41855
41856 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
41857         LDKUpdateFee a_conv;
41858         a_conv.inner = untag_ptr(a);
41859         a_conv.is_owned = ptr_is_owned(a);
41860         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41861         a_conv.is_owned = false;
41862         LDKUpdateFee b_conv;
41863         b_conv.inner = untag_ptr(b);
41864         b_conv.is_owned = ptr_is_owned(b);
41865         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41866         b_conv.is_owned = false;
41867         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
41868         return ret_conv;
41869 }
41870
41871 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
41872         LDKChannelReestablish this_obj_conv;
41873         this_obj_conv.inner = untag_ptr(this_obj);
41874         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41876         ChannelReestablish_free(this_obj_conv);
41877 }
41878
41879 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
41880         LDKChannelReestablish this_ptr_conv;
41881         this_ptr_conv.inner = untag_ptr(this_ptr);
41882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41884         this_ptr_conv.is_owned = false;
41885         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41886         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
41887         return ret_arr;
41888 }
41889
41890 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41891         LDKChannelReestablish this_ptr_conv;
41892         this_ptr_conv.inner = untag_ptr(this_ptr);
41893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41895         this_ptr_conv.is_owned = false;
41896         LDKThirtyTwoBytes val_ref;
41897         CHECK(val->arr_len == 32);
41898         memcpy(val_ref.data, val->elems, 32); FREE(val);
41899         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
41900 }
41901
41902 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
41903         LDKChannelReestablish this_ptr_conv;
41904         this_ptr_conv.inner = untag_ptr(this_ptr);
41905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41907         this_ptr_conv.is_owned = false;
41908         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
41909         return ret_conv;
41910 }
41911
41912 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) {
41913         LDKChannelReestablish this_ptr_conv;
41914         this_ptr_conv.inner = untag_ptr(this_ptr);
41915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41917         this_ptr_conv.is_owned = false;
41918         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
41919 }
41920
41921 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
41922         LDKChannelReestablish this_ptr_conv;
41923         this_ptr_conv.inner = untag_ptr(this_ptr);
41924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41926         this_ptr_conv.is_owned = false;
41927         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
41928         return ret_conv;
41929 }
41930
41931 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) {
41932         LDKChannelReestablish this_ptr_conv;
41933         this_ptr_conv.inner = untag_ptr(this_ptr);
41934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41936         this_ptr_conv.is_owned = false;
41937         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
41938 }
41939
41940 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) {
41941         LDKChannelReestablish this_ptr_conv;
41942         this_ptr_conv.inner = untag_ptr(this_ptr);
41943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41945         this_ptr_conv.is_owned = false;
41946         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41947         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
41948         return ret_arr;
41949 }
41950
41951 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) {
41952         LDKChannelReestablish this_ptr_conv;
41953         this_ptr_conv.inner = untag_ptr(this_ptr);
41954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41956         this_ptr_conv.is_owned = false;
41957         LDKThirtyTwoBytes val_ref;
41958         CHECK(val->arr_len == 32);
41959         memcpy(val_ref.data, val->elems, 32); FREE(val);
41960         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
41961 }
41962
41963 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) {
41964         LDKChannelReestablish this_ptr_conv;
41965         this_ptr_conv.inner = untag_ptr(this_ptr);
41966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41968         this_ptr_conv.is_owned = false;
41969         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41970         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
41971         return ret_arr;
41972 }
41973
41974 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) {
41975         LDKChannelReestablish this_ptr_conv;
41976         this_ptr_conv.inner = untag_ptr(this_ptr);
41977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41979         this_ptr_conv.is_owned = false;
41980         LDKPublicKey val_ref;
41981         CHECK(val->arr_len == 33);
41982         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41983         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
41984 }
41985
41986 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
41987         LDKChannelReestablish this_ptr_conv;
41988         this_ptr_conv.inner = untag_ptr(this_ptr);
41989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41991         this_ptr_conv.is_owned = false;
41992         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
41993         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
41994         uint64_t ret_ref = tag_ptr(ret_copy, true);
41995         return ret_ref;
41996 }
41997
41998 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
41999         LDKChannelReestablish this_ptr_conv;
42000         this_ptr_conv.inner = untag_ptr(this_ptr);
42001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42003         this_ptr_conv.is_owned = false;
42004         void* val_ptr = untag_ptr(val);
42005         CHECK_ACCESS(val_ptr);
42006         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
42007         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
42008         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
42009 }
42010
42011 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) {
42012         LDKThirtyTwoBytes channel_id_arg_ref;
42013         CHECK(channel_id_arg->arr_len == 32);
42014         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42015         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
42016         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
42017         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
42018         LDKPublicKey my_current_per_commitment_point_arg_ref;
42019         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
42020         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);
42021         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
42022         CHECK_ACCESS(next_funding_txid_arg_ptr);
42023         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
42024         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
42025         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);
42026         uint64_t ret_ref = 0;
42027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42029         return ret_ref;
42030 }
42031
42032 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
42033         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
42034         uint64_t ret_ref = 0;
42035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42037         return ret_ref;
42038 }
42039 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
42040         LDKChannelReestablish arg_conv;
42041         arg_conv.inner = untag_ptr(arg);
42042         arg_conv.is_owned = ptr_is_owned(arg);
42043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42044         arg_conv.is_owned = false;
42045         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
42046         return ret_conv;
42047 }
42048
42049 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
42050         LDKChannelReestablish orig_conv;
42051         orig_conv.inner = untag_ptr(orig);
42052         orig_conv.is_owned = ptr_is_owned(orig);
42053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42054         orig_conv.is_owned = false;
42055         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
42056         uint64_t ret_ref = 0;
42057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42059         return ret_ref;
42060 }
42061
42062 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
42063         LDKChannelReestablish a_conv;
42064         a_conv.inner = untag_ptr(a);
42065         a_conv.is_owned = ptr_is_owned(a);
42066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42067         a_conv.is_owned = false;
42068         LDKChannelReestablish b_conv;
42069         b_conv.inner = untag_ptr(b);
42070         b_conv.is_owned = ptr_is_owned(b);
42071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42072         b_conv.is_owned = false;
42073         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
42074         return ret_conv;
42075 }
42076
42077 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
42078         LDKAnnouncementSignatures this_obj_conv;
42079         this_obj_conv.inner = untag_ptr(this_obj);
42080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42082         AnnouncementSignatures_free(this_obj_conv);
42083 }
42084
42085 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
42086         LDKAnnouncementSignatures this_ptr_conv;
42087         this_ptr_conv.inner = untag_ptr(this_ptr);
42088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42090         this_ptr_conv.is_owned = false;
42091         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42092         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
42093         return ret_arr;
42094 }
42095
42096 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42097         LDKAnnouncementSignatures this_ptr_conv;
42098         this_ptr_conv.inner = untag_ptr(this_ptr);
42099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42101         this_ptr_conv.is_owned = false;
42102         LDKThirtyTwoBytes val_ref;
42103         CHECK(val->arr_len == 32);
42104         memcpy(val_ref.data, val->elems, 32); FREE(val);
42105         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
42106 }
42107
42108 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
42109         LDKAnnouncementSignatures this_ptr_conv;
42110         this_ptr_conv.inner = untag_ptr(this_ptr);
42111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42113         this_ptr_conv.is_owned = false;
42114         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
42115         return ret_conv;
42116 }
42117
42118 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42119         LDKAnnouncementSignatures 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         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
42125 }
42126
42127 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
42128         LDKAnnouncementSignatures this_ptr_conv;
42129         this_ptr_conv.inner = untag_ptr(this_ptr);
42130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42132         this_ptr_conv.is_owned = false;
42133         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42134         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
42135         return ret_arr;
42136 }
42137
42138 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
42139         LDKAnnouncementSignatures this_ptr_conv;
42140         this_ptr_conv.inner = untag_ptr(this_ptr);
42141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42143         this_ptr_conv.is_owned = false;
42144         LDKECDSASignature val_ref;
42145         CHECK(val->arr_len == 64);
42146         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42147         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
42148 }
42149
42150 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
42151         LDKAnnouncementSignatures this_ptr_conv;
42152         this_ptr_conv.inner = untag_ptr(this_ptr);
42153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42155         this_ptr_conv.is_owned = false;
42156         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42157         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
42158         return ret_arr;
42159 }
42160
42161 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
42162         LDKAnnouncementSignatures this_ptr_conv;
42163         this_ptr_conv.inner = untag_ptr(this_ptr);
42164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42166         this_ptr_conv.is_owned = false;
42167         LDKECDSASignature val_ref;
42168         CHECK(val->arr_len == 64);
42169         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42170         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
42171 }
42172
42173 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) {
42174         LDKThirtyTwoBytes channel_id_arg_ref;
42175         CHECK(channel_id_arg->arr_len == 32);
42176         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42177         LDKECDSASignature node_signature_arg_ref;
42178         CHECK(node_signature_arg->arr_len == 64);
42179         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
42180         LDKECDSASignature bitcoin_signature_arg_ref;
42181         CHECK(bitcoin_signature_arg->arr_len == 64);
42182         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
42183         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
42184         uint64_t ret_ref = 0;
42185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42187         return ret_ref;
42188 }
42189
42190 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
42191         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
42192         uint64_t ret_ref = 0;
42193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42195         return ret_ref;
42196 }
42197 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
42198         LDKAnnouncementSignatures arg_conv;
42199         arg_conv.inner = untag_ptr(arg);
42200         arg_conv.is_owned = ptr_is_owned(arg);
42201         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42202         arg_conv.is_owned = false;
42203         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
42204         return ret_conv;
42205 }
42206
42207 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
42208         LDKAnnouncementSignatures orig_conv;
42209         orig_conv.inner = untag_ptr(orig);
42210         orig_conv.is_owned = ptr_is_owned(orig);
42211         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42212         orig_conv.is_owned = false;
42213         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
42214         uint64_t ret_ref = 0;
42215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42217         return ret_ref;
42218 }
42219
42220 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
42221         LDKAnnouncementSignatures a_conv;
42222         a_conv.inner = untag_ptr(a);
42223         a_conv.is_owned = ptr_is_owned(a);
42224         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42225         a_conv.is_owned = false;
42226         LDKAnnouncementSignatures b_conv;
42227         b_conv.inner = untag_ptr(b);
42228         b_conv.is_owned = ptr_is_owned(b);
42229         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42230         b_conv.is_owned = false;
42231         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
42232         return ret_conv;
42233 }
42234
42235 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
42236         if (!ptr_is_owned(this_ptr)) return;
42237         void* this_ptr_ptr = untag_ptr(this_ptr);
42238         CHECK_ACCESS(this_ptr_ptr);
42239         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
42240         FREE(untag_ptr(this_ptr));
42241         SocketAddress_free(this_ptr_conv);
42242 }
42243
42244 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
42245         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42246         *ret_copy = SocketAddress_clone(arg);
42247         uint64_t ret_ref = tag_ptr(ret_copy, true);
42248         return ret_ref;
42249 }
42250 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
42251         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
42252         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
42253         return ret_conv;
42254 }
42255
42256 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
42257         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
42258         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42259         *ret_copy = SocketAddress_clone(orig_conv);
42260         uint64_t ret_ref = tag_ptr(ret_copy, true);
42261         return ret_ref;
42262 }
42263
42264 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
42265         LDKFourBytes addr_ref;
42266         CHECK(addr->arr_len == 4);
42267         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
42268         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42269         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
42270         uint64_t ret_ref = tag_ptr(ret_copy, true);
42271         return ret_ref;
42272 }
42273
42274 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
42275         LDKSixteenBytes addr_ref;
42276         CHECK(addr->arr_len == 16);
42277         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
42278         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42279         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
42280         uint64_t ret_ref = tag_ptr(ret_copy, true);
42281         return ret_ref;
42282 }
42283
42284 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
42285         LDKTwelveBytes a_ref;
42286         CHECK(a->arr_len == 12);
42287         memcpy(a_ref.data, a->elems, 12); FREE(a);
42288         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42289         *ret_copy = SocketAddress_onion_v2(a_ref);
42290         uint64_t ret_ref = tag_ptr(ret_copy, true);
42291         return ret_ref;
42292 }
42293
42294 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v3"))) TS_SocketAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
42295         LDKThirtyTwoBytes ed25519_pubkey_ref;
42296         CHECK(ed25519_pubkey->arr_len == 32);
42297         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
42298         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42299         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
42300         uint64_t ret_ref = tag_ptr(ret_copy, true);
42301         return ret_ref;
42302 }
42303
42304 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
42305         LDKHostname hostname_conv;
42306         hostname_conv.inner = untag_ptr(hostname);
42307         hostname_conv.is_owned = ptr_is_owned(hostname);
42308         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
42309         hostname_conv = Hostname_clone(&hostname_conv);
42310         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42311         *ret_copy = SocketAddress_hostname(hostname_conv, port);
42312         uint64_t ret_ref = tag_ptr(ret_copy, true);
42313         return ret_ref;
42314 }
42315
42316 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
42317         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
42318         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
42319         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
42320         return ret_conv;
42321 }
42322
42323 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
42324         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
42325         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
42326         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42327         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42328         CVec_u8Z_free(ret_var);
42329         return ret_arr;
42330 }
42331
42332 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
42333         LDKu8slice ser_ref;
42334         ser_ref.datalen = ser->arr_len;
42335         ser_ref.data = ser->elems;
42336         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
42337         *ret_conv = SocketAddress_read(ser_ref);
42338         FREE(ser);
42339         return tag_ptr(ret_conv, true);
42340 }
42341
42342 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
42343         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
42344         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
42345         return ret_conv;
42346 }
42347
42348 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
42349         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
42350         return ret_conv;
42351 }
42352
42353 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
42354         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
42355         return ret_conv;
42356 }
42357
42358 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
42359         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
42360         return ret_conv;
42361 }
42362
42363 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
42364         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
42365         return ret_conv;
42366 }
42367
42368 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
42369         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
42370         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
42371         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
42372         return ret_conv;
42373 }
42374
42375 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
42376         LDKStr host_conv = str_ref_to_owned_c(host);
42377         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
42378         *ret_conv = parse_onion_address(host_conv, port);
42379         return tag_ptr(ret_conv, true);
42380 }
42381
42382 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
42383         if (!ptr_is_owned(this_ptr)) return;
42384         void* this_ptr_ptr = untag_ptr(this_ptr);
42385         CHECK_ACCESS(this_ptr_ptr);
42386         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
42387         FREE(untag_ptr(this_ptr));
42388         UnsignedGossipMessage_free(this_ptr_conv);
42389 }
42390
42391 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
42392         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42393         *ret_copy = UnsignedGossipMessage_clone(arg);
42394         uint64_t ret_ref = tag_ptr(ret_copy, true);
42395         return ret_ref;
42396 }
42397 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
42398         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
42399         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
42400         return ret_conv;
42401 }
42402
42403 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
42404         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
42405         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42406         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
42407         uint64_t ret_ref = tag_ptr(ret_copy, true);
42408         return ret_ref;
42409 }
42410
42411 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
42412         LDKUnsignedChannelAnnouncement a_conv;
42413         a_conv.inner = untag_ptr(a);
42414         a_conv.is_owned = ptr_is_owned(a);
42415         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42416         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
42417         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42418         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
42419         uint64_t ret_ref = tag_ptr(ret_copy, true);
42420         return ret_ref;
42421 }
42422
42423 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
42424         LDKUnsignedChannelUpdate a_conv;
42425         a_conv.inner = untag_ptr(a);
42426         a_conv.is_owned = ptr_is_owned(a);
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42428         a_conv = UnsignedChannelUpdate_clone(&a_conv);
42429         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42430         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
42431         uint64_t ret_ref = tag_ptr(ret_copy, true);
42432         return ret_ref;
42433 }
42434
42435 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
42436         LDKUnsignedNodeAnnouncement a_conv;
42437         a_conv.inner = untag_ptr(a);
42438         a_conv.is_owned = ptr_is_owned(a);
42439         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42440         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
42441         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42442         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
42443         uint64_t ret_ref = tag_ptr(ret_copy, true);
42444         return ret_ref;
42445 }
42446
42447 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
42448         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
42449         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
42450         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42451         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42452         CVec_u8Z_free(ret_var);
42453         return ret_arr;
42454 }
42455
42456 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
42457         LDKUnsignedNodeAnnouncement this_obj_conv;
42458         this_obj_conv.inner = untag_ptr(this_obj);
42459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42461         UnsignedNodeAnnouncement_free(this_obj_conv);
42462 }
42463
42464 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
42465         LDKUnsignedNodeAnnouncement this_ptr_conv;
42466         this_ptr_conv.inner = untag_ptr(this_ptr);
42467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42469         this_ptr_conv.is_owned = false;
42470         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
42471         uint64_t ret_ref = 0;
42472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42474         return ret_ref;
42475 }
42476
42477 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
42478         LDKUnsignedNodeAnnouncement this_ptr_conv;
42479         this_ptr_conv.inner = untag_ptr(this_ptr);
42480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42482         this_ptr_conv.is_owned = false;
42483         LDKNodeFeatures val_conv;
42484         val_conv.inner = untag_ptr(val);
42485         val_conv.is_owned = ptr_is_owned(val);
42486         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42487         val_conv = NodeFeatures_clone(&val_conv);
42488         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
42489 }
42490
42491 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
42492         LDKUnsignedNodeAnnouncement this_ptr_conv;
42493         this_ptr_conv.inner = untag_ptr(this_ptr);
42494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42496         this_ptr_conv.is_owned = false;
42497         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
42498         return ret_conv;
42499 }
42500
42501 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
42502         LDKUnsignedNodeAnnouncement this_ptr_conv;
42503         this_ptr_conv.inner = untag_ptr(this_ptr);
42504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42506         this_ptr_conv.is_owned = false;
42507         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
42508 }
42509
42510 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
42511         LDKUnsignedNodeAnnouncement this_ptr_conv;
42512         this_ptr_conv.inner = untag_ptr(this_ptr);
42513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42515         this_ptr_conv.is_owned = false;
42516         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
42517         uint64_t ret_ref = 0;
42518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42520         return ret_ref;
42521 }
42522
42523 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
42524         LDKUnsignedNodeAnnouncement this_ptr_conv;
42525         this_ptr_conv.inner = untag_ptr(this_ptr);
42526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42528         this_ptr_conv.is_owned = false;
42529         LDKNodeId val_conv;
42530         val_conv.inner = untag_ptr(val);
42531         val_conv.is_owned = ptr_is_owned(val);
42532         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42533         val_conv = NodeId_clone(&val_conv);
42534         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
42535 }
42536
42537 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
42538         LDKUnsignedNodeAnnouncement this_ptr_conv;
42539         this_ptr_conv.inner = untag_ptr(this_ptr);
42540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42542         this_ptr_conv.is_owned = false;
42543         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
42544         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
42545         return ret_arr;
42546 }
42547
42548 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
42549         LDKUnsignedNodeAnnouncement this_ptr_conv;
42550         this_ptr_conv.inner = untag_ptr(this_ptr);
42551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42553         this_ptr_conv.is_owned = false;
42554         LDKThreeBytes val_ref;
42555         CHECK(val->arr_len == 3);
42556         memcpy(val_ref.data, val->elems, 3); FREE(val);
42557         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
42558 }
42559
42560 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
42561         LDKUnsignedNodeAnnouncement this_ptr_conv;
42562         this_ptr_conv.inner = untag_ptr(this_ptr);
42563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42565         this_ptr_conv.is_owned = false;
42566         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
42567         uint64_t ret_ref = 0;
42568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42570         return ret_ref;
42571 }
42572
42573 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
42574         LDKUnsignedNodeAnnouncement this_ptr_conv;
42575         this_ptr_conv.inner = untag_ptr(this_ptr);
42576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42578         this_ptr_conv.is_owned = false;
42579         LDKNodeAlias val_conv;
42580         val_conv.inner = untag_ptr(val);
42581         val_conv.is_owned = ptr_is_owned(val);
42582         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42583         val_conv = NodeAlias_clone(&val_conv);
42584         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
42585 }
42586
42587 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
42588         LDKUnsignedNodeAnnouncement this_ptr_conv;
42589         this_ptr_conv.inner = untag_ptr(this_ptr);
42590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42592         this_ptr_conv.is_owned = false;
42593         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
42594         uint64_tArray ret_arr = NULL;
42595         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42596         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42597         for (size_t p = 0; p < ret_var.datalen; p++) {
42598                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42599                 *ret_conv_15_copy = ret_var.data[p];
42600                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
42601                 ret_arr_ptr[p] = ret_conv_15_ref;
42602         }
42603         
42604         FREE(ret_var.data);
42605         return ret_arr;
42606 }
42607
42608 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
42609         LDKUnsignedNodeAnnouncement this_ptr_conv;
42610         this_ptr_conv.inner = untag_ptr(this_ptr);
42611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42613         this_ptr_conv.is_owned = false;
42614         LDKCVec_SocketAddressZ val_constr;
42615         val_constr.datalen = val->arr_len;
42616         if (val_constr.datalen > 0)
42617                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
42618         else
42619                 val_constr.data = NULL;
42620         uint64_t* val_vals = val->elems;
42621         for (size_t p = 0; p < val_constr.datalen; p++) {
42622                 uint64_t val_conv_15 = val_vals[p];
42623                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
42624                 CHECK_ACCESS(val_conv_15_ptr);
42625                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
42626                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
42627                 val_constr.data[p] = val_conv_15_conv;
42628         }
42629         FREE(val);
42630         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
42631 }
42632
42633 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
42634         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
42635         uint64_t ret_ref = 0;
42636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42638         return ret_ref;
42639 }
42640 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
42641         LDKUnsignedNodeAnnouncement arg_conv;
42642         arg_conv.inner = untag_ptr(arg);
42643         arg_conv.is_owned = ptr_is_owned(arg);
42644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42645         arg_conv.is_owned = false;
42646         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
42647         return ret_conv;
42648 }
42649
42650 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
42651         LDKUnsignedNodeAnnouncement orig_conv;
42652         orig_conv.inner = untag_ptr(orig);
42653         orig_conv.is_owned = ptr_is_owned(orig);
42654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42655         orig_conv.is_owned = false;
42656         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
42657         uint64_t ret_ref = 0;
42658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42660         return ret_ref;
42661 }
42662
42663 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
42664         LDKUnsignedNodeAnnouncement a_conv;
42665         a_conv.inner = untag_ptr(a);
42666         a_conv.is_owned = ptr_is_owned(a);
42667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42668         a_conv.is_owned = false;
42669         LDKUnsignedNodeAnnouncement b_conv;
42670         b_conv.inner = untag_ptr(b);
42671         b_conv.is_owned = ptr_is_owned(b);
42672         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42673         b_conv.is_owned = false;
42674         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
42675         return ret_conv;
42676 }
42677
42678 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
42679         LDKNodeAnnouncement this_obj_conv;
42680         this_obj_conv.inner = untag_ptr(this_obj);
42681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42683         NodeAnnouncement_free(this_obj_conv);
42684 }
42685
42686 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
42687         LDKNodeAnnouncement this_ptr_conv;
42688         this_ptr_conv.inner = untag_ptr(this_ptr);
42689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42691         this_ptr_conv.is_owned = false;
42692         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42693         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
42694         return ret_arr;
42695 }
42696
42697 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
42698         LDKNodeAnnouncement this_ptr_conv;
42699         this_ptr_conv.inner = untag_ptr(this_ptr);
42700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42702         this_ptr_conv.is_owned = false;
42703         LDKECDSASignature val_ref;
42704         CHECK(val->arr_len == 64);
42705         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42706         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
42707 }
42708
42709 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
42710         LDKNodeAnnouncement this_ptr_conv;
42711         this_ptr_conv.inner = untag_ptr(this_ptr);
42712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42714         this_ptr_conv.is_owned = false;
42715         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
42716         uint64_t ret_ref = 0;
42717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42719         return ret_ref;
42720 }
42721
42722 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
42723         LDKNodeAnnouncement this_ptr_conv;
42724         this_ptr_conv.inner = untag_ptr(this_ptr);
42725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42727         this_ptr_conv.is_owned = false;
42728         LDKUnsignedNodeAnnouncement val_conv;
42729         val_conv.inner = untag_ptr(val);
42730         val_conv.is_owned = ptr_is_owned(val);
42731         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42732         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
42733         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
42734 }
42735
42736 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
42737         LDKECDSASignature signature_arg_ref;
42738         CHECK(signature_arg->arr_len == 64);
42739         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
42740         LDKUnsignedNodeAnnouncement contents_arg_conv;
42741         contents_arg_conv.inner = untag_ptr(contents_arg);
42742         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
42743         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
42744         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
42745         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
42746         uint64_t ret_ref = 0;
42747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42749         return ret_ref;
42750 }
42751
42752 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
42753         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
42754         uint64_t ret_ref = 0;
42755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42757         return ret_ref;
42758 }
42759 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
42760         LDKNodeAnnouncement arg_conv;
42761         arg_conv.inner = untag_ptr(arg);
42762         arg_conv.is_owned = ptr_is_owned(arg);
42763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42764         arg_conv.is_owned = false;
42765         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
42766         return ret_conv;
42767 }
42768
42769 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
42770         LDKNodeAnnouncement orig_conv;
42771         orig_conv.inner = untag_ptr(orig);
42772         orig_conv.is_owned = ptr_is_owned(orig);
42773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42774         orig_conv.is_owned = false;
42775         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
42776         uint64_t ret_ref = 0;
42777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42779         return ret_ref;
42780 }
42781
42782 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
42783         LDKNodeAnnouncement a_conv;
42784         a_conv.inner = untag_ptr(a);
42785         a_conv.is_owned = ptr_is_owned(a);
42786         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42787         a_conv.is_owned = false;
42788         LDKNodeAnnouncement b_conv;
42789         b_conv.inner = untag_ptr(b);
42790         b_conv.is_owned = ptr_is_owned(b);
42791         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42792         b_conv.is_owned = false;
42793         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
42794         return ret_conv;
42795 }
42796
42797 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
42798         LDKUnsignedChannelAnnouncement this_obj_conv;
42799         this_obj_conv.inner = untag_ptr(this_obj);
42800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42802         UnsignedChannelAnnouncement_free(this_obj_conv);
42803 }
42804
42805 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
42806         LDKUnsignedChannelAnnouncement this_ptr_conv;
42807         this_ptr_conv.inner = untag_ptr(this_ptr);
42808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42810         this_ptr_conv.is_owned = false;
42811         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
42812         uint64_t ret_ref = 0;
42813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42815         return ret_ref;
42816 }
42817
42818 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
42819         LDKUnsignedChannelAnnouncement this_ptr_conv;
42820         this_ptr_conv.inner = untag_ptr(this_ptr);
42821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42823         this_ptr_conv.is_owned = false;
42824         LDKChannelFeatures val_conv;
42825         val_conv.inner = untag_ptr(val);
42826         val_conv.is_owned = ptr_is_owned(val);
42827         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42828         val_conv = ChannelFeatures_clone(&val_conv);
42829         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
42830 }
42831
42832 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
42833         LDKUnsignedChannelAnnouncement this_ptr_conv;
42834         this_ptr_conv.inner = untag_ptr(this_ptr);
42835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42837         this_ptr_conv.is_owned = false;
42838         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42839         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
42840         return ret_arr;
42841 }
42842
42843 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
42844         LDKUnsignedChannelAnnouncement this_ptr_conv;
42845         this_ptr_conv.inner = untag_ptr(this_ptr);
42846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42848         this_ptr_conv.is_owned = false;
42849         LDKThirtyTwoBytes val_ref;
42850         CHECK(val->arr_len == 32);
42851         memcpy(val_ref.data, val->elems, 32); FREE(val);
42852         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
42853 }
42854
42855 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
42856         LDKUnsignedChannelAnnouncement this_ptr_conv;
42857         this_ptr_conv.inner = untag_ptr(this_ptr);
42858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42860         this_ptr_conv.is_owned = false;
42861         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
42862         return ret_conv;
42863 }
42864
42865 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42866         LDKUnsignedChannelAnnouncement this_ptr_conv;
42867         this_ptr_conv.inner = untag_ptr(this_ptr);
42868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42870         this_ptr_conv.is_owned = false;
42871         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
42872 }
42873
42874 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
42875         LDKUnsignedChannelAnnouncement this_ptr_conv;
42876         this_ptr_conv.inner = untag_ptr(this_ptr);
42877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42879         this_ptr_conv.is_owned = false;
42880         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
42881         uint64_t ret_ref = 0;
42882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42884         return ret_ref;
42885 }
42886
42887 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
42888         LDKUnsignedChannelAnnouncement this_ptr_conv;
42889         this_ptr_conv.inner = untag_ptr(this_ptr);
42890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42892         this_ptr_conv.is_owned = false;
42893         LDKNodeId val_conv;
42894         val_conv.inner = untag_ptr(val);
42895         val_conv.is_owned = ptr_is_owned(val);
42896         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42897         val_conv = NodeId_clone(&val_conv);
42898         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
42899 }
42900
42901 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
42902         LDKUnsignedChannelAnnouncement this_ptr_conv;
42903         this_ptr_conv.inner = untag_ptr(this_ptr);
42904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42906         this_ptr_conv.is_owned = false;
42907         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
42908         uint64_t ret_ref = 0;
42909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42911         return ret_ref;
42912 }
42913
42914 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
42915         LDKUnsignedChannelAnnouncement this_ptr_conv;
42916         this_ptr_conv.inner = untag_ptr(this_ptr);
42917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42919         this_ptr_conv.is_owned = false;
42920         LDKNodeId val_conv;
42921         val_conv.inner = untag_ptr(val);
42922         val_conv.is_owned = ptr_is_owned(val);
42923         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42924         val_conv = NodeId_clone(&val_conv);
42925         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
42926 }
42927
42928 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
42929         LDKUnsignedChannelAnnouncement this_ptr_conv;
42930         this_ptr_conv.inner = untag_ptr(this_ptr);
42931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42933         this_ptr_conv.is_owned = false;
42934         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
42935         uint64_t ret_ref = 0;
42936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42938         return ret_ref;
42939 }
42940
42941 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
42942         LDKUnsignedChannelAnnouncement this_ptr_conv;
42943         this_ptr_conv.inner = untag_ptr(this_ptr);
42944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42946         this_ptr_conv.is_owned = false;
42947         LDKNodeId val_conv;
42948         val_conv.inner = untag_ptr(val);
42949         val_conv.is_owned = ptr_is_owned(val);
42950         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42951         val_conv = NodeId_clone(&val_conv);
42952         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
42953 }
42954
42955 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
42956         LDKUnsignedChannelAnnouncement this_ptr_conv;
42957         this_ptr_conv.inner = untag_ptr(this_ptr);
42958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42960         this_ptr_conv.is_owned = false;
42961         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
42962         uint64_t ret_ref = 0;
42963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42965         return ret_ref;
42966 }
42967
42968 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
42969         LDKUnsignedChannelAnnouncement this_ptr_conv;
42970         this_ptr_conv.inner = untag_ptr(this_ptr);
42971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42973         this_ptr_conv.is_owned = false;
42974         LDKNodeId val_conv;
42975         val_conv.inner = untag_ptr(val);
42976         val_conv.is_owned = ptr_is_owned(val);
42977         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42978         val_conv = NodeId_clone(&val_conv);
42979         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
42980 }
42981
42982 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
42983         LDKUnsignedChannelAnnouncement this_ptr_conv;
42984         this_ptr_conv.inner = untag_ptr(this_ptr);
42985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42987         this_ptr_conv.is_owned = false;
42988         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
42989         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42990         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42991         CVec_u8Z_free(ret_var);
42992         return ret_arr;
42993 }
42994
42995 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
42996         LDKUnsignedChannelAnnouncement this_ptr_conv;
42997         this_ptr_conv.inner = untag_ptr(this_ptr);
42998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43000         this_ptr_conv.is_owned = false;
43001         LDKCVec_u8Z val_ref;
43002         val_ref.datalen = val->arr_len;
43003         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43004         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
43005         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
43006 }
43007
43008 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_new"))) TS_UnsignedChannelAnnouncement_new(uint64_t features_arg, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, uint64_t node_id_1_arg, uint64_t node_id_2_arg, uint64_t bitcoin_key_1_arg, uint64_t bitcoin_key_2_arg, int8_tArray excess_data_arg) {
43009         LDKChannelFeatures features_arg_conv;
43010         features_arg_conv.inner = untag_ptr(features_arg);
43011         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43012         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43013         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
43014         LDKThirtyTwoBytes chain_hash_arg_ref;
43015         CHECK(chain_hash_arg->arr_len == 32);
43016         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43017         LDKNodeId node_id_1_arg_conv;
43018         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
43019         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
43020         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
43021         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
43022         LDKNodeId node_id_2_arg_conv;
43023         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
43024         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
43025         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
43026         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
43027         LDKNodeId bitcoin_key_1_arg_conv;
43028         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
43029         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
43030         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
43031         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
43032         LDKNodeId bitcoin_key_2_arg_conv;
43033         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
43034         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
43035         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
43036         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
43037         LDKCVec_u8Z excess_data_arg_ref;
43038         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
43039         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43040         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
43041         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_new(features_arg_conv, chain_hash_arg_ref, short_channel_id_arg, node_id_1_arg_conv, node_id_2_arg_conv, bitcoin_key_1_arg_conv, bitcoin_key_2_arg_conv, excess_data_arg_ref);
43042         uint64_t ret_ref = 0;
43043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43045         return ret_ref;
43046 }
43047
43048 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
43049         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
43050         uint64_t ret_ref = 0;
43051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43053         return ret_ref;
43054 }
43055 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
43056         LDKUnsignedChannelAnnouncement arg_conv;
43057         arg_conv.inner = untag_ptr(arg);
43058         arg_conv.is_owned = ptr_is_owned(arg);
43059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43060         arg_conv.is_owned = false;
43061         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
43062         return ret_conv;
43063 }
43064
43065 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
43066         LDKUnsignedChannelAnnouncement orig_conv;
43067         orig_conv.inner = untag_ptr(orig);
43068         orig_conv.is_owned = ptr_is_owned(orig);
43069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43070         orig_conv.is_owned = false;
43071         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
43072         uint64_t ret_ref = 0;
43073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43075         return ret_ref;
43076 }
43077
43078 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
43079         LDKUnsignedChannelAnnouncement a_conv;
43080         a_conv.inner = untag_ptr(a);
43081         a_conv.is_owned = ptr_is_owned(a);
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43083         a_conv.is_owned = false;
43084         LDKUnsignedChannelAnnouncement b_conv;
43085         b_conv.inner = untag_ptr(b);
43086         b_conv.is_owned = ptr_is_owned(b);
43087         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43088         b_conv.is_owned = false;
43089         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
43090         return ret_conv;
43091 }
43092
43093 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
43094         LDKChannelAnnouncement this_obj_conv;
43095         this_obj_conv.inner = untag_ptr(this_obj);
43096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43098         ChannelAnnouncement_free(this_obj_conv);
43099 }
43100
43101 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
43102         LDKChannelAnnouncement this_ptr_conv;
43103         this_ptr_conv.inner = untag_ptr(this_ptr);
43104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43106         this_ptr_conv.is_owned = false;
43107         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43108         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
43109         return ret_arr;
43110 }
43111
43112 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
43113         LDKChannelAnnouncement this_ptr_conv;
43114         this_ptr_conv.inner = untag_ptr(this_ptr);
43115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43117         this_ptr_conv.is_owned = false;
43118         LDKECDSASignature val_ref;
43119         CHECK(val->arr_len == 64);
43120         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43121         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
43122 }
43123
43124 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
43125         LDKChannelAnnouncement this_ptr_conv;
43126         this_ptr_conv.inner = untag_ptr(this_ptr);
43127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43129         this_ptr_conv.is_owned = false;
43130         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43131         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
43132         return ret_arr;
43133 }
43134
43135 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
43136         LDKChannelAnnouncement this_ptr_conv;
43137         this_ptr_conv.inner = untag_ptr(this_ptr);
43138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43140         this_ptr_conv.is_owned = false;
43141         LDKECDSASignature val_ref;
43142         CHECK(val->arr_len == 64);
43143         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43144         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
43145 }
43146
43147 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
43148         LDKChannelAnnouncement this_ptr_conv;
43149         this_ptr_conv.inner = untag_ptr(this_ptr);
43150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43152         this_ptr_conv.is_owned = false;
43153         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43154         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
43155         return ret_arr;
43156 }
43157
43158 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
43159         LDKChannelAnnouncement this_ptr_conv;
43160         this_ptr_conv.inner = untag_ptr(this_ptr);
43161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43163         this_ptr_conv.is_owned = false;
43164         LDKECDSASignature val_ref;
43165         CHECK(val->arr_len == 64);
43166         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43167         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
43168 }
43169
43170 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
43171         LDKChannelAnnouncement this_ptr_conv;
43172         this_ptr_conv.inner = untag_ptr(this_ptr);
43173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43175         this_ptr_conv.is_owned = false;
43176         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43177         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
43178         return ret_arr;
43179 }
43180
43181 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
43182         LDKChannelAnnouncement this_ptr_conv;
43183         this_ptr_conv.inner = untag_ptr(this_ptr);
43184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43186         this_ptr_conv.is_owned = false;
43187         LDKECDSASignature val_ref;
43188         CHECK(val->arr_len == 64);
43189         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43190         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
43191 }
43192
43193 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
43194         LDKChannelAnnouncement this_ptr_conv;
43195         this_ptr_conv.inner = untag_ptr(this_ptr);
43196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43198         this_ptr_conv.is_owned = false;
43199         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
43200         uint64_t ret_ref = 0;
43201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43203         return ret_ref;
43204 }
43205
43206 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
43207         LDKChannelAnnouncement this_ptr_conv;
43208         this_ptr_conv.inner = untag_ptr(this_ptr);
43209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43211         this_ptr_conv.is_owned = false;
43212         LDKUnsignedChannelAnnouncement val_conv;
43213         val_conv.inner = untag_ptr(val);
43214         val_conv.is_owned = ptr_is_owned(val);
43215         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43216         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
43217         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
43218 }
43219
43220 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) {
43221         LDKECDSASignature node_signature_1_arg_ref;
43222         CHECK(node_signature_1_arg->arr_len == 64);
43223         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
43224         LDKECDSASignature node_signature_2_arg_ref;
43225         CHECK(node_signature_2_arg->arr_len == 64);
43226         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
43227         LDKECDSASignature bitcoin_signature_1_arg_ref;
43228         CHECK(bitcoin_signature_1_arg->arr_len == 64);
43229         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
43230         LDKECDSASignature bitcoin_signature_2_arg_ref;
43231         CHECK(bitcoin_signature_2_arg->arr_len == 64);
43232         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
43233         LDKUnsignedChannelAnnouncement contents_arg_conv;
43234         contents_arg_conv.inner = untag_ptr(contents_arg);
43235         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
43236         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
43237         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
43238         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);
43239         uint64_t ret_ref = 0;
43240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43242         return ret_ref;
43243 }
43244
43245 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
43246         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
43247         uint64_t ret_ref = 0;
43248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43250         return ret_ref;
43251 }
43252 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
43253         LDKChannelAnnouncement arg_conv;
43254         arg_conv.inner = untag_ptr(arg);
43255         arg_conv.is_owned = ptr_is_owned(arg);
43256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43257         arg_conv.is_owned = false;
43258         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
43259         return ret_conv;
43260 }
43261
43262 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
43263         LDKChannelAnnouncement orig_conv;
43264         orig_conv.inner = untag_ptr(orig);
43265         orig_conv.is_owned = ptr_is_owned(orig);
43266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43267         orig_conv.is_owned = false;
43268         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
43269         uint64_t ret_ref = 0;
43270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43272         return ret_ref;
43273 }
43274
43275 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
43276         LDKChannelAnnouncement a_conv;
43277         a_conv.inner = untag_ptr(a);
43278         a_conv.is_owned = ptr_is_owned(a);
43279         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43280         a_conv.is_owned = false;
43281         LDKChannelAnnouncement b_conv;
43282         b_conv.inner = untag_ptr(b);
43283         b_conv.is_owned = ptr_is_owned(b);
43284         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43285         b_conv.is_owned = false;
43286         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
43287         return ret_conv;
43288 }
43289
43290 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
43291         LDKUnsignedChannelUpdate this_obj_conv;
43292         this_obj_conv.inner = untag_ptr(this_obj);
43293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43295         UnsignedChannelUpdate_free(this_obj_conv);
43296 }
43297
43298 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
43299         LDKUnsignedChannelUpdate this_ptr_conv;
43300         this_ptr_conv.inner = untag_ptr(this_ptr);
43301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43303         this_ptr_conv.is_owned = false;
43304         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43305         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
43306         return ret_arr;
43307 }
43308
43309 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43310         LDKUnsignedChannelUpdate this_ptr_conv;
43311         this_ptr_conv.inner = untag_ptr(this_ptr);
43312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43314         this_ptr_conv.is_owned = false;
43315         LDKThirtyTwoBytes val_ref;
43316         CHECK(val->arr_len == 32);
43317         memcpy(val_ref.data, val->elems, 32); FREE(val);
43318         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
43319 }
43320
43321 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
43322         LDKUnsignedChannelUpdate this_ptr_conv;
43323         this_ptr_conv.inner = untag_ptr(this_ptr);
43324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43326         this_ptr_conv.is_owned = false;
43327         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
43328         return ret_conv;
43329 }
43330
43331 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43332         LDKUnsignedChannelUpdate this_ptr_conv;
43333         this_ptr_conv.inner = untag_ptr(this_ptr);
43334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43336         this_ptr_conv.is_owned = false;
43337         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
43338 }
43339
43340 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
43341         LDKUnsignedChannelUpdate this_ptr_conv;
43342         this_ptr_conv.inner = untag_ptr(this_ptr);
43343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43345         this_ptr_conv.is_owned = false;
43346         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
43347         return ret_conv;
43348 }
43349
43350 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
43351         LDKUnsignedChannelUpdate this_ptr_conv;
43352         this_ptr_conv.inner = untag_ptr(this_ptr);
43353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43355         this_ptr_conv.is_owned = false;
43356         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
43357 }
43358
43359 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
43360         LDKUnsignedChannelUpdate this_ptr_conv;
43361         this_ptr_conv.inner = untag_ptr(this_ptr);
43362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43364         this_ptr_conv.is_owned = false;
43365         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
43366         return ret_conv;
43367 }
43368
43369 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
43370         LDKUnsignedChannelUpdate this_ptr_conv;
43371         this_ptr_conv.inner = untag_ptr(this_ptr);
43372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43374         this_ptr_conv.is_owned = false;
43375         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
43376 }
43377
43378 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
43379         LDKUnsignedChannelUpdate this_ptr_conv;
43380         this_ptr_conv.inner = untag_ptr(this_ptr);
43381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43383         this_ptr_conv.is_owned = false;
43384         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
43385         return ret_conv;
43386 }
43387
43388 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
43389         LDKUnsignedChannelUpdate this_ptr_conv;
43390         this_ptr_conv.inner = untag_ptr(this_ptr);
43391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43393         this_ptr_conv.is_owned = false;
43394         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
43395 }
43396
43397 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
43398         LDKUnsignedChannelUpdate this_ptr_conv;
43399         this_ptr_conv.inner = untag_ptr(this_ptr);
43400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43402         this_ptr_conv.is_owned = false;
43403         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
43404         return ret_conv;
43405 }
43406
43407 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
43408         LDKUnsignedChannelUpdate this_ptr_conv;
43409         this_ptr_conv.inner = untag_ptr(this_ptr);
43410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43412         this_ptr_conv.is_owned = false;
43413         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
43414 }
43415
43416 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
43417         LDKUnsignedChannelUpdate this_ptr_conv;
43418         this_ptr_conv.inner = untag_ptr(this_ptr);
43419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43421         this_ptr_conv.is_owned = false;
43422         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
43423         return ret_conv;
43424 }
43425
43426 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
43427         LDKUnsignedChannelUpdate this_ptr_conv;
43428         this_ptr_conv.inner = untag_ptr(this_ptr);
43429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43431         this_ptr_conv.is_owned = false;
43432         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
43433 }
43434
43435 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
43436         LDKUnsignedChannelUpdate this_ptr_conv;
43437         this_ptr_conv.inner = untag_ptr(this_ptr);
43438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43440         this_ptr_conv.is_owned = false;
43441         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
43442         return ret_conv;
43443 }
43444
43445 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
43446         LDKUnsignedChannelUpdate this_ptr_conv;
43447         this_ptr_conv.inner = untag_ptr(this_ptr);
43448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43450         this_ptr_conv.is_owned = false;
43451         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
43452 }
43453
43454 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
43455         LDKUnsignedChannelUpdate this_ptr_conv;
43456         this_ptr_conv.inner = untag_ptr(this_ptr);
43457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43459         this_ptr_conv.is_owned = false;
43460         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
43461         return ret_conv;
43462 }
43463
43464 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
43465         LDKUnsignedChannelUpdate this_ptr_conv;
43466         this_ptr_conv.inner = untag_ptr(this_ptr);
43467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43469         this_ptr_conv.is_owned = false;
43470         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
43471 }
43472
43473 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
43474         LDKUnsignedChannelUpdate this_ptr_conv;
43475         this_ptr_conv.inner = untag_ptr(this_ptr);
43476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43478         this_ptr_conv.is_owned = false;
43479         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
43480         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43481         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43482         CVec_u8Z_free(ret_var);
43483         return ret_arr;
43484 }
43485
43486 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
43487         LDKUnsignedChannelUpdate this_ptr_conv;
43488         this_ptr_conv.inner = untag_ptr(this_ptr);
43489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43491         this_ptr_conv.is_owned = false;
43492         LDKCVec_u8Z val_ref;
43493         val_ref.datalen = val->arr_len;
43494         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43495         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
43496         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
43497 }
43498
43499 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) {
43500         LDKThirtyTwoBytes chain_hash_arg_ref;
43501         CHECK(chain_hash_arg->arr_len == 32);
43502         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43503         LDKCVec_u8Z excess_data_arg_ref;
43504         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
43505         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43506         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
43507         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);
43508         uint64_t ret_ref = 0;
43509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43511         return ret_ref;
43512 }
43513
43514 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
43515         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
43516         uint64_t ret_ref = 0;
43517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43519         return ret_ref;
43520 }
43521 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
43522         LDKUnsignedChannelUpdate arg_conv;
43523         arg_conv.inner = untag_ptr(arg);
43524         arg_conv.is_owned = ptr_is_owned(arg);
43525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43526         arg_conv.is_owned = false;
43527         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
43528         return ret_conv;
43529 }
43530
43531 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
43532         LDKUnsignedChannelUpdate orig_conv;
43533         orig_conv.inner = untag_ptr(orig);
43534         orig_conv.is_owned = ptr_is_owned(orig);
43535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43536         orig_conv.is_owned = false;
43537         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
43538         uint64_t ret_ref = 0;
43539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43541         return ret_ref;
43542 }
43543
43544 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
43545         LDKUnsignedChannelUpdate a_conv;
43546         a_conv.inner = untag_ptr(a);
43547         a_conv.is_owned = ptr_is_owned(a);
43548         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43549         a_conv.is_owned = false;
43550         LDKUnsignedChannelUpdate b_conv;
43551         b_conv.inner = untag_ptr(b);
43552         b_conv.is_owned = ptr_is_owned(b);
43553         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43554         b_conv.is_owned = false;
43555         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
43556         return ret_conv;
43557 }
43558
43559 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
43560         LDKChannelUpdate this_obj_conv;
43561         this_obj_conv.inner = untag_ptr(this_obj);
43562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43564         ChannelUpdate_free(this_obj_conv);
43565 }
43566
43567 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
43568         LDKChannelUpdate this_ptr_conv;
43569         this_ptr_conv.inner = untag_ptr(this_ptr);
43570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43572         this_ptr_conv.is_owned = false;
43573         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43574         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
43575         return ret_arr;
43576 }
43577
43578 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
43579         LDKChannelUpdate this_ptr_conv;
43580         this_ptr_conv.inner = untag_ptr(this_ptr);
43581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43583         this_ptr_conv.is_owned = false;
43584         LDKECDSASignature val_ref;
43585         CHECK(val->arr_len == 64);
43586         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43587         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
43588 }
43589
43590 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
43591         LDKChannelUpdate this_ptr_conv;
43592         this_ptr_conv.inner = untag_ptr(this_ptr);
43593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43595         this_ptr_conv.is_owned = false;
43596         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
43597         uint64_t ret_ref = 0;
43598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43600         return ret_ref;
43601 }
43602
43603 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
43604         LDKChannelUpdate this_ptr_conv;
43605         this_ptr_conv.inner = untag_ptr(this_ptr);
43606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43608         this_ptr_conv.is_owned = false;
43609         LDKUnsignedChannelUpdate val_conv;
43610         val_conv.inner = untag_ptr(val);
43611         val_conv.is_owned = ptr_is_owned(val);
43612         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43613         val_conv = UnsignedChannelUpdate_clone(&val_conv);
43614         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
43615 }
43616
43617 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
43618         LDKECDSASignature signature_arg_ref;
43619         CHECK(signature_arg->arr_len == 64);
43620         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43621         LDKUnsignedChannelUpdate contents_arg_conv;
43622         contents_arg_conv.inner = untag_ptr(contents_arg);
43623         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
43624         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
43625         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
43626         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
43627         uint64_t ret_ref = 0;
43628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43630         return ret_ref;
43631 }
43632
43633 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
43634         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
43635         uint64_t ret_ref = 0;
43636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43638         return ret_ref;
43639 }
43640 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
43641         LDKChannelUpdate arg_conv;
43642         arg_conv.inner = untag_ptr(arg);
43643         arg_conv.is_owned = ptr_is_owned(arg);
43644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43645         arg_conv.is_owned = false;
43646         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
43647         return ret_conv;
43648 }
43649
43650 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
43651         LDKChannelUpdate orig_conv;
43652         orig_conv.inner = untag_ptr(orig);
43653         orig_conv.is_owned = ptr_is_owned(orig);
43654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43655         orig_conv.is_owned = false;
43656         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
43657         uint64_t ret_ref = 0;
43658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43660         return ret_ref;
43661 }
43662
43663 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
43664         LDKChannelUpdate a_conv;
43665         a_conv.inner = untag_ptr(a);
43666         a_conv.is_owned = ptr_is_owned(a);
43667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43668         a_conv.is_owned = false;
43669         LDKChannelUpdate b_conv;
43670         b_conv.inner = untag_ptr(b);
43671         b_conv.is_owned = ptr_is_owned(b);
43672         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43673         b_conv.is_owned = false;
43674         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
43675         return ret_conv;
43676 }
43677
43678 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
43679         LDKQueryChannelRange this_obj_conv;
43680         this_obj_conv.inner = untag_ptr(this_obj);
43681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43683         QueryChannelRange_free(this_obj_conv);
43684 }
43685
43686 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
43687         LDKQueryChannelRange this_ptr_conv;
43688         this_ptr_conv.inner = untag_ptr(this_ptr);
43689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43691         this_ptr_conv.is_owned = false;
43692         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43693         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
43694         return ret_arr;
43695 }
43696
43697 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43698         LDKQueryChannelRange this_ptr_conv;
43699         this_ptr_conv.inner = untag_ptr(this_ptr);
43700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43702         this_ptr_conv.is_owned = false;
43703         LDKThirtyTwoBytes val_ref;
43704         CHECK(val->arr_len == 32);
43705         memcpy(val_ref.data, val->elems, 32); FREE(val);
43706         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
43707 }
43708
43709 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
43710         LDKQueryChannelRange this_ptr_conv;
43711         this_ptr_conv.inner = untag_ptr(this_ptr);
43712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43714         this_ptr_conv.is_owned = false;
43715         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
43716         return ret_conv;
43717 }
43718
43719 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
43720         LDKQueryChannelRange this_ptr_conv;
43721         this_ptr_conv.inner = untag_ptr(this_ptr);
43722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43724         this_ptr_conv.is_owned = false;
43725         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
43726 }
43727
43728 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
43729         LDKQueryChannelRange this_ptr_conv;
43730         this_ptr_conv.inner = untag_ptr(this_ptr);
43731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43733         this_ptr_conv.is_owned = false;
43734         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
43735         return ret_conv;
43736 }
43737
43738 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
43739         LDKQueryChannelRange this_ptr_conv;
43740         this_ptr_conv.inner = untag_ptr(this_ptr);
43741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43743         this_ptr_conv.is_owned = false;
43744         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
43745 }
43746
43747 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) {
43748         LDKThirtyTwoBytes chain_hash_arg_ref;
43749         CHECK(chain_hash_arg->arr_len == 32);
43750         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43751         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
43752         uint64_t ret_ref = 0;
43753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43755         return ret_ref;
43756 }
43757
43758 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
43759         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
43760         uint64_t ret_ref = 0;
43761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43763         return ret_ref;
43764 }
43765 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
43766         LDKQueryChannelRange arg_conv;
43767         arg_conv.inner = untag_ptr(arg);
43768         arg_conv.is_owned = ptr_is_owned(arg);
43769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43770         arg_conv.is_owned = false;
43771         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
43772         return ret_conv;
43773 }
43774
43775 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
43776         LDKQueryChannelRange orig_conv;
43777         orig_conv.inner = untag_ptr(orig);
43778         orig_conv.is_owned = ptr_is_owned(orig);
43779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43780         orig_conv.is_owned = false;
43781         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
43782         uint64_t ret_ref = 0;
43783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43785         return ret_ref;
43786 }
43787
43788 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
43789         LDKQueryChannelRange a_conv;
43790         a_conv.inner = untag_ptr(a);
43791         a_conv.is_owned = ptr_is_owned(a);
43792         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43793         a_conv.is_owned = false;
43794         LDKQueryChannelRange b_conv;
43795         b_conv.inner = untag_ptr(b);
43796         b_conv.is_owned = ptr_is_owned(b);
43797         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43798         b_conv.is_owned = false;
43799         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
43800         return ret_conv;
43801 }
43802
43803 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
43804         LDKReplyChannelRange this_obj_conv;
43805         this_obj_conv.inner = untag_ptr(this_obj);
43806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43808         ReplyChannelRange_free(this_obj_conv);
43809 }
43810
43811 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
43812         LDKReplyChannelRange this_ptr_conv;
43813         this_ptr_conv.inner = untag_ptr(this_ptr);
43814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43816         this_ptr_conv.is_owned = false;
43817         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43818         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
43819         return ret_arr;
43820 }
43821
43822 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43823         LDKReplyChannelRange this_ptr_conv;
43824         this_ptr_conv.inner = untag_ptr(this_ptr);
43825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43827         this_ptr_conv.is_owned = false;
43828         LDKThirtyTwoBytes val_ref;
43829         CHECK(val->arr_len == 32);
43830         memcpy(val_ref.data, val->elems, 32); FREE(val);
43831         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
43832 }
43833
43834 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
43835         LDKReplyChannelRange this_ptr_conv;
43836         this_ptr_conv.inner = untag_ptr(this_ptr);
43837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43839         this_ptr_conv.is_owned = false;
43840         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
43841         return ret_conv;
43842 }
43843
43844 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
43845         LDKReplyChannelRange this_ptr_conv;
43846         this_ptr_conv.inner = untag_ptr(this_ptr);
43847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43849         this_ptr_conv.is_owned = false;
43850         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
43851 }
43852
43853 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
43854         LDKReplyChannelRange this_ptr_conv;
43855         this_ptr_conv.inner = untag_ptr(this_ptr);
43856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43858         this_ptr_conv.is_owned = false;
43859         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
43860         return ret_conv;
43861 }
43862
43863 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
43864         LDKReplyChannelRange this_ptr_conv;
43865         this_ptr_conv.inner = untag_ptr(this_ptr);
43866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43868         this_ptr_conv.is_owned = false;
43869         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
43870 }
43871
43872 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
43873         LDKReplyChannelRange this_ptr_conv;
43874         this_ptr_conv.inner = untag_ptr(this_ptr);
43875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43877         this_ptr_conv.is_owned = false;
43878         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
43879         return ret_conv;
43880 }
43881
43882 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
43883         LDKReplyChannelRange this_ptr_conv;
43884         this_ptr_conv.inner = untag_ptr(this_ptr);
43885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43887         this_ptr_conv.is_owned = false;
43888         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
43889 }
43890
43891 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
43892         LDKReplyChannelRange this_ptr_conv;
43893         this_ptr_conv.inner = untag_ptr(this_ptr);
43894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43896         this_ptr_conv.is_owned = false;
43897         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
43898         int64_tArray ret_arr = NULL;
43899         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
43900         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
43901         for (size_t i = 0; i < ret_var.datalen; i++) {
43902                 int64_t ret_conv_8_conv = ret_var.data[i];
43903                 ret_arr_ptr[i] = ret_conv_8_conv;
43904         }
43905         
43906         FREE(ret_var.data);
43907         return ret_arr;
43908 }
43909
43910 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
43911         LDKReplyChannelRange this_ptr_conv;
43912         this_ptr_conv.inner = untag_ptr(this_ptr);
43913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43915         this_ptr_conv.is_owned = false;
43916         LDKCVec_u64Z val_constr;
43917         val_constr.datalen = val->arr_len;
43918         if (val_constr.datalen > 0)
43919                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43920         else
43921                 val_constr.data = NULL;
43922         int64_t* val_vals = val->elems;
43923         for (size_t i = 0; i < val_constr.datalen; i++) {
43924                 int64_t val_conv_8 = val_vals[i];
43925                 val_constr.data[i] = val_conv_8;
43926         }
43927         FREE(val);
43928         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
43929 }
43930
43931 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) {
43932         LDKThirtyTwoBytes chain_hash_arg_ref;
43933         CHECK(chain_hash_arg->arr_len == 32);
43934         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43935         LDKCVec_u64Z short_channel_ids_arg_constr;
43936         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
43937         if (short_channel_ids_arg_constr.datalen > 0)
43938                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43939         else
43940                 short_channel_ids_arg_constr.data = NULL;
43941         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
43942         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
43943                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
43944                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
43945         }
43946         FREE(short_channel_ids_arg);
43947         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
43948         uint64_t ret_ref = 0;
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43951         return ret_ref;
43952 }
43953
43954 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
43955         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
43956         uint64_t ret_ref = 0;
43957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43959         return ret_ref;
43960 }
43961 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
43962         LDKReplyChannelRange arg_conv;
43963         arg_conv.inner = untag_ptr(arg);
43964         arg_conv.is_owned = ptr_is_owned(arg);
43965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43966         arg_conv.is_owned = false;
43967         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
43968         return ret_conv;
43969 }
43970
43971 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
43972         LDKReplyChannelRange orig_conv;
43973         orig_conv.inner = untag_ptr(orig);
43974         orig_conv.is_owned = ptr_is_owned(orig);
43975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43976         orig_conv.is_owned = false;
43977         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
43978         uint64_t ret_ref = 0;
43979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43981         return ret_ref;
43982 }
43983
43984 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
43985         LDKReplyChannelRange a_conv;
43986         a_conv.inner = untag_ptr(a);
43987         a_conv.is_owned = ptr_is_owned(a);
43988         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43989         a_conv.is_owned = false;
43990         LDKReplyChannelRange b_conv;
43991         b_conv.inner = untag_ptr(b);
43992         b_conv.is_owned = ptr_is_owned(b);
43993         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43994         b_conv.is_owned = false;
43995         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
43996         return ret_conv;
43997 }
43998
43999 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
44000         LDKQueryShortChannelIds 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         QueryShortChannelIds_free(this_obj_conv);
44005 }
44006
44007 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
44008         LDKQueryShortChannelIds 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44014         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
44015         return ret_arr;
44016 }
44017
44018 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44019         LDKQueryShortChannelIds 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         LDKThirtyTwoBytes val_ref;
44025         CHECK(val->arr_len == 32);
44026         memcpy(val_ref.data, val->elems, 32); FREE(val);
44027         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
44028 }
44029
44030 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
44031         LDKQueryShortChannelIds this_ptr_conv;
44032         this_ptr_conv.inner = untag_ptr(this_ptr);
44033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44035         this_ptr_conv.is_owned = false;
44036         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
44037         int64_tArray ret_arr = NULL;
44038         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44039         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44040         for (size_t i = 0; i < ret_var.datalen; i++) {
44041                 int64_t ret_conv_8_conv = ret_var.data[i];
44042                 ret_arr_ptr[i] = ret_conv_8_conv;
44043         }
44044         
44045         FREE(ret_var.data);
44046         return ret_arr;
44047 }
44048
44049 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
44050         LDKQueryShortChannelIds this_ptr_conv;
44051         this_ptr_conv.inner = untag_ptr(this_ptr);
44052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44054         this_ptr_conv.is_owned = false;
44055         LDKCVec_u64Z val_constr;
44056         val_constr.datalen = val->arr_len;
44057         if (val_constr.datalen > 0)
44058                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44059         else
44060                 val_constr.data = NULL;
44061         int64_t* val_vals = val->elems;
44062         for (size_t i = 0; i < val_constr.datalen; i++) {
44063                 int64_t val_conv_8 = val_vals[i];
44064                 val_constr.data[i] = val_conv_8;
44065         }
44066         FREE(val);
44067         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
44068 }
44069
44070 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
44071         LDKThirtyTwoBytes chain_hash_arg_ref;
44072         CHECK(chain_hash_arg->arr_len == 32);
44073         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44074         LDKCVec_u64Z short_channel_ids_arg_constr;
44075         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
44076         if (short_channel_ids_arg_constr.datalen > 0)
44077                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44078         else
44079                 short_channel_ids_arg_constr.data = NULL;
44080         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
44081         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
44082                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
44083                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
44084         }
44085         FREE(short_channel_ids_arg);
44086         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
44087         uint64_t ret_ref = 0;
44088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44090         return ret_ref;
44091 }
44092
44093 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
44094         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
44095         uint64_t ret_ref = 0;
44096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44098         return ret_ref;
44099 }
44100 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
44101         LDKQueryShortChannelIds arg_conv;
44102         arg_conv.inner = untag_ptr(arg);
44103         arg_conv.is_owned = ptr_is_owned(arg);
44104         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44105         arg_conv.is_owned = false;
44106         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
44107         return ret_conv;
44108 }
44109
44110 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
44111         LDKQueryShortChannelIds orig_conv;
44112         orig_conv.inner = untag_ptr(orig);
44113         orig_conv.is_owned = ptr_is_owned(orig);
44114         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44115         orig_conv.is_owned = false;
44116         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
44117         uint64_t ret_ref = 0;
44118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44120         return ret_ref;
44121 }
44122
44123 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
44124         LDKQueryShortChannelIds a_conv;
44125         a_conv.inner = untag_ptr(a);
44126         a_conv.is_owned = ptr_is_owned(a);
44127         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44128         a_conv.is_owned = false;
44129         LDKQueryShortChannelIds b_conv;
44130         b_conv.inner = untag_ptr(b);
44131         b_conv.is_owned = ptr_is_owned(b);
44132         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44133         b_conv.is_owned = false;
44134         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
44135         return ret_conv;
44136 }
44137
44138 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
44139         LDKReplyShortChannelIdsEnd this_obj_conv;
44140         this_obj_conv.inner = untag_ptr(this_obj);
44141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44143         ReplyShortChannelIdsEnd_free(this_obj_conv);
44144 }
44145
44146 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
44147         LDKReplyShortChannelIdsEnd this_ptr_conv;
44148         this_ptr_conv.inner = untag_ptr(this_ptr);
44149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44151         this_ptr_conv.is_owned = false;
44152         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44153         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
44154         return ret_arr;
44155 }
44156
44157 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44158         LDKReplyShortChannelIdsEnd this_ptr_conv;
44159         this_ptr_conv.inner = untag_ptr(this_ptr);
44160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44162         this_ptr_conv.is_owned = false;
44163         LDKThirtyTwoBytes val_ref;
44164         CHECK(val->arr_len == 32);
44165         memcpy(val_ref.data, val->elems, 32); FREE(val);
44166         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
44167 }
44168
44169 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
44170         LDKReplyShortChannelIdsEnd this_ptr_conv;
44171         this_ptr_conv.inner = untag_ptr(this_ptr);
44172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44174         this_ptr_conv.is_owned = false;
44175         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
44176         return ret_conv;
44177 }
44178
44179 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
44180         LDKReplyShortChannelIdsEnd this_ptr_conv;
44181         this_ptr_conv.inner = untag_ptr(this_ptr);
44182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44184         this_ptr_conv.is_owned = false;
44185         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
44186 }
44187
44188 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
44189         LDKThirtyTwoBytes chain_hash_arg_ref;
44190         CHECK(chain_hash_arg->arr_len == 32);
44191         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44192         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
44193         uint64_t ret_ref = 0;
44194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44196         return ret_ref;
44197 }
44198
44199 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
44200         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
44201         uint64_t ret_ref = 0;
44202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44204         return ret_ref;
44205 }
44206 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
44207         LDKReplyShortChannelIdsEnd arg_conv;
44208         arg_conv.inner = untag_ptr(arg);
44209         arg_conv.is_owned = ptr_is_owned(arg);
44210         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44211         arg_conv.is_owned = false;
44212         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
44213         return ret_conv;
44214 }
44215
44216 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
44217         LDKReplyShortChannelIdsEnd orig_conv;
44218         orig_conv.inner = untag_ptr(orig);
44219         orig_conv.is_owned = ptr_is_owned(orig);
44220         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44221         orig_conv.is_owned = false;
44222         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
44223         uint64_t ret_ref = 0;
44224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44226         return ret_ref;
44227 }
44228
44229 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
44230         LDKReplyShortChannelIdsEnd a_conv;
44231         a_conv.inner = untag_ptr(a);
44232         a_conv.is_owned = ptr_is_owned(a);
44233         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44234         a_conv.is_owned = false;
44235         LDKReplyShortChannelIdsEnd b_conv;
44236         b_conv.inner = untag_ptr(b);
44237         b_conv.is_owned = ptr_is_owned(b);
44238         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44239         b_conv.is_owned = false;
44240         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
44241         return ret_conv;
44242 }
44243
44244 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
44245         LDKGossipTimestampFilter this_obj_conv;
44246         this_obj_conv.inner = untag_ptr(this_obj);
44247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44249         GossipTimestampFilter_free(this_obj_conv);
44250 }
44251
44252 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
44253         LDKGossipTimestampFilter this_ptr_conv;
44254         this_ptr_conv.inner = untag_ptr(this_ptr);
44255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44257         this_ptr_conv.is_owned = false;
44258         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44259         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
44260         return ret_arr;
44261 }
44262
44263 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44264         LDKGossipTimestampFilter this_ptr_conv;
44265         this_ptr_conv.inner = untag_ptr(this_ptr);
44266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44268         this_ptr_conv.is_owned = false;
44269         LDKThirtyTwoBytes val_ref;
44270         CHECK(val->arr_len == 32);
44271         memcpy(val_ref.data, val->elems, 32); FREE(val);
44272         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
44273 }
44274
44275 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
44276         LDKGossipTimestampFilter this_ptr_conv;
44277         this_ptr_conv.inner = untag_ptr(this_ptr);
44278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44280         this_ptr_conv.is_owned = false;
44281         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
44282         return ret_conv;
44283 }
44284
44285 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
44286         LDKGossipTimestampFilter this_ptr_conv;
44287         this_ptr_conv.inner = untag_ptr(this_ptr);
44288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44290         this_ptr_conv.is_owned = false;
44291         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
44292 }
44293
44294 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
44295         LDKGossipTimestampFilter this_ptr_conv;
44296         this_ptr_conv.inner = untag_ptr(this_ptr);
44297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44299         this_ptr_conv.is_owned = false;
44300         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
44301         return ret_conv;
44302 }
44303
44304 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
44305         LDKGossipTimestampFilter this_ptr_conv;
44306         this_ptr_conv.inner = untag_ptr(this_ptr);
44307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44309         this_ptr_conv.is_owned = false;
44310         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
44311 }
44312
44313 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) {
44314         LDKThirtyTwoBytes chain_hash_arg_ref;
44315         CHECK(chain_hash_arg->arr_len == 32);
44316         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44317         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
44318         uint64_t ret_ref = 0;
44319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44321         return ret_ref;
44322 }
44323
44324 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
44325         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
44326         uint64_t ret_ref = 0;
44327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44329         return ret_ref;
44330 }
44331 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
44332         LDKGossipTimestampFilter arg_conv;
44333         arg_conv.inner = untag_ptr(arg);
44334         arg_conv.is_owned = ptr_is_owned(arg);
44335         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44336         arg_conv.is_owned = false;
44337         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
44338         return ret_conv;
44339 }
44340
44341 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
44342         LDKGossipTimestampFilter orig_conv;
44343         orig_conv.inner = untag_ptr(orig);
44344         orig_conv.is_owned = ptr_is_owned(orig);
44345         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44346         orig_conv.is_owned = false;
44347         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
44348         uint64_t ret_ref = 0;
44349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44351         return ret_ref;
44352 }
44353
44354 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
44355         LDKGossipTimestampFilter a_conv;
44356         a_conv.inner = untag_ptr(a);
44357         a_conv.is_owned = ptr_is_owned(a);
44358         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44359         a_conv.is_owned = false;
44360         LDKGossipTimestampFilter b_conv;
44361         b_conv.inner = untag_ptr(b);
44362         b_conv.is_owned = ptr_is_owned(b);
44363         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44364         b_conv.is_owned = false;
44365         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
44366         return ret_conv;
44367 }
44368
44369 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
44370         if (!ptr_is_owned(this_ptr)) return;
44371         void* this_ptr_ptr = untag_ptr(this_ptr);
44372         CHECK_ACCESS(this_ptr_ptr);
44373         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
44374         FREE(untag_ptr(this_ptr));
44375         ErrorAction_free(this_ptr_conv);
44376 }
44377
44378 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
44379         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44380         *ret_copy = ErrorAction_clone(arg);
44381         uint64_t ret_ref = tag_ptr(ret_copy, true);
44382         return ret_ref;
44383 }
44384 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
44385         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
44386         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
44387         return ret_conv;
44388 }
44389
44390 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
44391         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
44392         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44393         *ret_copy = ErrorAction_clone(orig_conv);
44394         uint64_t ret_ref = tag_ptr(ret_copy, true);
44395         return ret_ref;
44396 }
44397
44398 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
44399         LDKErrorMessage msg_conv;
44400         msg_conv.inner = untag_ptr(msg);
44401         msg_conv.is_owned = ptr_is_owned(msg);
44402         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44403         msg_conv = ErrorMessage_clone(&msg_conv);
44404         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44405         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
44406         uint64_t ret_ref = tag_ptr(ret_copy, true);
44407         return ret_ref;
44408 }
44409
44410 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
44411         LDKWarningMessage msg_conv;
44412         msg_conv.inner = untag_ptr(msg);
44413         msg_conv.is_owned = ptr_is_owned(msg);
44414         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44415         msg_conv = WarningMessage_clone(&msg_conv);
44416         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44417         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
44418         uint64_t ret_ref = tag_ptr(ret_copy, true);
44419         return ret_ref;
44420 }
44421
44422 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
44423         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44424         *ret_copy = ErrorAction_ignore_error();
44425         uint64_t ret_ref = tag_ptr(ret_copy, true);
44426         return ret_ref;
44427 }
44428
44429 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
44430         LDKLevel a_conv = LDKLevel_from_js(a);
44431         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44432         *ret_copy = ErrorAction_ignore_and_log(a_conv);
44433         uint64_t ret_ref = tag_ptr(ret_copy, true);
44434         return ret_ref;
44435 }
44436
44437 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
44438         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44439         *ret_copy = ErrorAction_ignore_duplicate_gossip();
44440         uint64_t ret_ref = tag_ptr(ret_copy, true);
44441         return ret_ref;
44442 }
44443
44444 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
44445         LDKErrorMessage msg_conv;
44446         msg_conv.inner = untag_ptr(msg);
44447         msg_conv.is_owned = ptr_is_owned(msg);
44448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44449         msg_conv = ErrorMessage_clone(&msg_conv);
44450         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44451         *ret_copy = ErrorAction_send_error_message(msg_conv);
44452         uint64_t ret_ref = tag_ptr(ret_copy, true);
44453         return ret_ref;
44454 }
44455
44456 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
44457         LDKWarningMessage msg_conv;
44458         msg_conv.inner = untag_ptr(msg);
44459         msg_conv.is_owned = ptr_is_owned(msg);
44460         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44461         msg_conv = WarningMessage_clone(&msg_conv);
44462         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
44463         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44464         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
44465         uint64_t ret_ref = tag_ptr(ret_copy, true);
44466         return ret_ref;
44467 }
44468
44469 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
44470         LDKLightningError this_obj_conv;
44471         this_obj_conv.inner = untag_ptr(this_obj);
44472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44474         LightningError_free(this_obj_conv);
44475 }
44476
44477 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
44478         LDKLightningError this_ptr_conv;
44479         this_ptr_conv.inner = untag_ptr(this_ptr);
44480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44482         this_ptr_conv.is_owned = false;
44483         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
44484         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44485         Str_free(ret_str);
44486         return ret_conv;
44487 }
44488
44489 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
44490         LDKLightningError this_ptr_conv;
44491         this_ptr_conv.inner = untag_ptr(this_ptr);
44492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44494         this_ptr_conv.is_owned = false;
44495         LDKStr val_conv = str_ref_to_owned_c(val);
44496         LightningError_set_err(&this_ptr_conv, val_conv);
44497 }
44498
44499 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
44500         LDKLightningError this_ptr_conv;
44501         this_ptr_conv.inner = untag_ptr(this_ptr);
44502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44504         this_ptr_conv.is_owned = false;
44505         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44506         *ret_copy = LightningError_get_action(&this_ptr_conv);
44507         uint64_t ret_ref = tag_ptr(ret_copy, true);
44508         return ret_ref;
44509 }
44510
44511 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
44512         LDKLightningError this_ptr_conv;
44513         this_ptr_conv.inner = untag_ptr(this_ptr);
44514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44516         this_ptr_conv.is_owned = false;
44517         void* val_ptr = untag_ptr(val);
44518         CHECK_ACCESS(val_ptr);
44519         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
44520         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
44521         LightningError_set_action(&this_ptr_conv, val_conv);
44522 }
44523
44524 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
44525         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
44526         void* action_arg_ptr = untag_ptr(action_arg);
44527         CHECK_ACCESS(action_arg_ptr);
44528         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
44529         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
44530         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
44531         uint64_t ret_ref = 0;
44532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44534         return ret_ref;
44535 }
44536
44537 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
44538         LDKLightningError ret_var = LightningError_clone(arg);
44539         uint64_t ret_ref = 0;
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44542         return ret_ref;
44543 }
44544 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
44545         LDKLightningError arg_conv;
44546         arg_conv.inner = untag_ptr(arg);
44547         arg_conv.is_owned = ptr_is_owned(arg);
44548         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44549         arg_conv.is_owned = false;
44550         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
44551         return ret_conv;
44552 }
44553
44554 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
44555         LDKLightningError orig_conv;
44556         orig_conv.inner = untag_ptr(orig);
44557         orig_conv.is_owned = ptr_is_owned(orig);
44558         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44559         orig_conv.is_owned = false;
44560         LDKLightningError ret_var = LightningError_clone(&orig_conv);
44561         uint64_t ret_ref = 0;
44562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44564         return ret_ref;
44565 }
44566
44567 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
44568         LDKCommitmentUpdate this_obj_conv;
44569         this_obj_conv.inner = untag_ptr(this_obj);
44570         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44572         CommitmentUpdate_free(this_obj_conv);
44573 }
44574
44575 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
44576         LDKCommitmentUpdate this_ptr_conv;
44577         this_ptr_conv.inner = untag_ptr(this_ptr);
44578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44580         this_ptr_conv.is_owned = false;
44581         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
44582         uint64_tArray ret_arr = NULL;
44583         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44584         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44585         for (size_t p = 0; p < ret_var.datalen; p++) {
44586                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
44587                 uint64_t ret_conv_15_ref = 0;
44588                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
44589                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
44590                 ret_arr_ptr[p] = ret_conv_15_ref;
44591         }
44592         
44593         FREE(ret_var.data);
44594         return ret_arr;
44595 }
44596
44597 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
44598         LDKCommitmentUpdate this_ptr_conv;
44599         this_ptr_conv.inner = untag_ptr(this_ptr);
44600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44602         this_ptr_conv.is_owned = false;
44603         LDKCVec_UpdateAddHTLCZ val_constr;
44604         val_constr.datalen = val->arr_len;
44605         if (val_constr.datalen > 0)
44606                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
44607         else
44608                 val_constr.data = NULL;
44609         uint64_t* val_vals = val->elems;
44610         for (size_t p = 0; p < val_constr.datalen; p++) {
44611                 uint64_t val_conv_15 = val_vals[p];
44612                 LDKUpdateAddHTLC val_conv_15_conv;
44613                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
44614                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
44615                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
44616                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
44617                 val_constr.data[p] = val_conv_15_conv;
44618         }
44619         FREE(val);
44620         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
44621 }
44622
44623 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
44624         LDKCommitmentUpdate this_ptr_conv;
44625         this_ptr_conv.inner = untag_ptr(this_ptr);
44626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44628         this_ptr_conv.is_owned = false;
44629         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
44630         uint64_tArray ret_arr = NULL;
44631         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44632         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44633         for (size_t t = 0; t < ret_var.datalen; t++) {
44634                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
44635                 uint64_t ret_conv_19_ref = 0;
44636                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
44637                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
44638                 ret_arr_ptr[t] = ret_conv_19_ref;
44639         }
44640         
44641         FREE(ret_var.data);
44642         return ret_arr;
44643 }
44644
44645 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
44646         LDKCommitmentUpdate this_ptr_conv;
44647         this_ptr_conv.inner = untag_ptr(this_ptr);
44648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44650         this_ptr_conv.is_owned = false;
44651         LDKCVec_UpdateFulfillHTLCZ val_constr;
44652         val_constr.datalen = val->arr_len;
44653         if (val_constr.datalen > 0)
44654                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
44655         else
44656                 val_constr.data = NULL;
44657         uint64_t* val_vals = val->elems;
44658         for (size_t t = 0; t < val_constr.datalen; t++) {
44659                 uint64_t val_conv_19 = val_vals[t];
44660                 LDKUpdateFulfillHTLC val_conv_19_conv;
44661                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
44662                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
44663                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
44664                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
44665                 val_constr.data[t] = val_conv_19_conv;
44666         }
44667         FREE(val);
44668         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
44669 }
44670
44671 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
44672         LDKCommitmentUpdate this_ptr_conv;
44673         this_ptr_conv.inner = untag_ptr(this_ptr);
44674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44676         this_ptr_conv.is_owned = false;
44677         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
44678         uint64_tArray ret_arr = NULL;
44679         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44680         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44681         for (size_t q = 0; q < ret_var.datalen; q++) {
44682                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
44683                 uint64_t ret_conv_16_ref = 0;
44684                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
44685                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
44686                 ret_arr_ptr[q] = ret_conv_16_ref;
44687         }
44688         
44689         FREE(ret_var.data);
44690         return ret_arr;
44691 }
44692
44693 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
44694         LDKCommitmentUpdate this_ptr_conv;
44695         this_ptr_conv.inner = untag_ptr(this_ptr);
44696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44698         this_ptr_conv.is_owned = false;
44699         LDKCVec_UpdateFailHTLCZ val_constr;
44700         val_constr.datalen = val->arr_len;
44701         if (val_constr.datalen > 0)
44702                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
44703         else
44704                 val_constr.data = NULL;
44705         uint64_t* val_vals = val->elems;
44706         for (size_t q = 0; q < val_constr.datalen; q++) {
44707                 uint64_t val_conv_16 = val_vals[q];
44708                 LDKUpdateFailHTLC val_conv_16_conv;
44709                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
44710                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
44711                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
44712                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
44713                 val_constr.data[q] = val_conv_16_conv;
44714         }
44715         FREE(val);
44716         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
44717 }
44718
44719 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
44720         LDKCommitmentUpdate this_ptr_conv;
44721         this_ptr_conv.inner = untag_ptr(this_ptr);
44722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44724         this_ptr_conv.is_owned = false;
44725         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
44726         uint64_tArray ret_arr = NULL;
44727         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44728         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44729         for (size_t z = 0; z < ret_var.datalen; z++) {
44730                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
44731                 uint64_t ret_conv_25_ref = 0;
44732                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
44733                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
44734                 ret_arr_ptr[z] = ret_conv_25_ref;
44735         }
44736         
44737         FREE(ret_var.data);
44738         return ret_arr;
44739 }
44740
44741 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) {
44742         LDKCommitmentUpdate this_ptr_conv;
44743         this_ptr_conv.inner = untag_ptr(this_ptr);
44744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44746         this_ptr_conv.is_owned = false;
44747         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
44748         val_constr.datalen = val->arr_len;
44749         if (val_constr.datalen > 0)
44750                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
44751         else
44752                 val_constr.data = NULL;
44753         uint64_t* val_vals = val->elems;
44754         for (size_t z = 0; z < val_constr.datalen; z++) {
44755                 uint64_t val_conv_25 = val_vals[z];
44756                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
44757                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
44758                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
44759                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
44760                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
44761                 val_constr.data[z] = val_conv_25_conv;
44762         }
44763         FREE(val);
44764         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
44765 }
44766
44767 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
44768         LDKCommitmentUpdate 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         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
44774         uint64_t ret_ref = 0;
44775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44777         return ret_ref;
44778 }
44779
44780 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
44781         LDKCommitmentUpdate this_ptr_conv;
44782         this_ptr_conv.inner = untag_ptr(this_ptr);
44783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44785         this_ptr_conv.is_owned = false;
44786         LDKUpdateFee val_conv;
44787         val_conv.inner = untag_ptr(val);
44788         val_conv.is_owned = ptr_is_owned(val);
44789         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44790         val_conv = UpdateFee_clone(&val_conv);
44791         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
44792 }
44793
44794 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
44795         LDKCommitmentUpdate this_ptr_conv;
44796         this_ptr_conv.inner = untag_ptr(this_ptr);
44797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44799         this_ptr_conv.is_owned = false;
44800         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
44801         uint64_t ret_ref = 0;
44802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44804         return ret_ref;
44805 }
44806
44807 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
44808         LDKCommitmentUpdate this_ptr_conv;
44809         this_ptr_conv.inner = untag_ptr(this_ptr);
44810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44812         this_ptr_conv.is_owned = false;
44813         LDKCommitmentSigned val_conv;
44814         val_conv.inner = untag_ptr(val);
44815         val_conv.is_owned = ptr_is_owned(val);
44816         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44817         val_conv = CommitmentSigned_clone(&val_conv);
44818         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
44819 }
44820
44821 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) {
44822         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
44823         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
44824         if (update_add_htlcs_arg_constr.datalen > 0)
44825                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
44826         else
44827                 update_add_htlcs_arg_constr.data = NULL;
44828         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
44829         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
44830                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
44831                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
44832                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
44833                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
44834                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
44835                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
44836                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
44837         }
44838         FREE(update_add_htlcs_arg);
44839         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
44840         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
44841         if (update_fulfill_htlcs_arg_constr.datalen > 0)
44842                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
44843         else
44844                 update_fulfill_htlcs_arg_constr.data = NULL;
44845         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
44846         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
44847                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
44848                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
44849                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
44850                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
44851                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
44852                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
44853                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
44854         }
44855         FREE(update_fulfill_htlcs_arg);
44856         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
44857         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
44858         if (update_fail_htlcs_arg_constr.datalen > 0)
44859                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
44860         else
44861                 update_fail_htlcs_arg_constr.data = NULL;
44862         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
44863         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
44864                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
44865                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
44866                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
44867                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
44868                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
44869                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
44870                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
44871         }
44872         FREE(update_fail_htlcs_arg);
44873         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
44874         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
44875         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
44876                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
44877         else
44878                 update_fail_malformed_htlcs_arg_constr.data = NULL;
44879         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
44880         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
44881                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
44882                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
44883                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
44884                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
44885                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
44886                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
44887                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
44888         }
44889         FREE(update_fail_malformed_htlcs_arg);
44890         LDKUpdateFee update_fee_arg_conv;
44891         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
44892         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
44893         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
44894         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
44895         LDKCommitmentSigned commitment_signed_arg_conv;
44896         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
44897         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
44898         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
44899         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
44900         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);
44901         uint64_t ret_ref = 0;
44902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44904         return ret_ref;
44905 }
44906
44907 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
44908         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
44909         uint64_t ret_ref = 0;
44910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44912         return ret_ref;
44913 }
44914 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
44915         LDKCommitmentUpdate arg_conv;
44916         arg_conv.inner = untag_ptr(arg);
44917         arg_conv.is_owned = ptr_is_owned(arg);
44918         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44919         arg_conv.is_owned = false;
44920         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
44921         return ret_conv;
44922 }
44923
44924 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
44925         LDKCommitmentUpdate orig_conv;
44926         orig_conv.inner = untag_ptr(orig);
44927         orig_conv.is_owned = ptr_is_owned(orig);
44928         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44929         orig_conv.is_owned = false;
44930         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
44931         uint64_t ret_ref = 0;
44932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44934         return ret_ref;
44935 }
44936
44937 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
44938         LDKCommitmentUpdate a_conv;
44939         a_conv.inner = untag_ptr(a);
44940         a_conv.is_owned = ptr_is_owned(a);
44941         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44942         a_conv.is_owned = false;
44943         LDKCommitmentUpdate b_conv;
44944         b_conv.inner = untag_ptr(b);
44945         b_conv.is_owned = ptr_is_owned(b);
44946         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44947         b_conv.is_owned = false;
44948         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
44949         return ret_conv;
44950 }
44951
44952 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
44953         if (!ptr_is_owned(this_ptr)) return;
44954         void* this_ptr_ptr = untag_ptr(this_ptr);
44955         CHECK_ACCESS(this_ptr_ptr);
44956         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
44957         FREE(untag_ptr(this_ptr));
44958         ChannelMessageHandler_free(this_ptr_conv);
44959 }
44960
44961 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
44962         if (!ptr_is_owned(this_ptr)) return;
44963         void* this_ptr_ptr = untag_ptr(this_ptr);
44964         CHECK_ACCESS(this_ptr_ptr);
44965         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
44966         FREE(untag_ptr(this_ptr));
44967         RoutingMessageHandler_free(this_ptr_conv);
44968 }
44969
44970 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
44971         if (!ptr_is_owned(this_ptr)) return;
44972         void* this_ptr_ptr = untag_ptr(this_ptr);
44973         CHECK_ACCESS(this_ptr_ptr);
44974         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
44975         FREE(untag_ptr(this_ptr));
44976         OnionMessageHandler_free(this_ptr_conv);
44977 }
44978
44979 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
44980         LDKAcceptChannel obj_conv;
44981         obj_conv.inner = untag_ptr(obj);
44982         obj_conv.is_owned = ptr_is_owned(obj);
44983         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44984         obj_conv.is_owned = false;
44985         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
44986         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44987         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44988         CVec_u8Z_free(ret_var);
44989         return ret_arr;
44990 }
44991
44992 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
44993         LDKu8slice ser_ref;
44994         ser_ref.datalen = ser->arr_len;
44995         ser_ref.data = ser->elems;
44996         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
44997         *ret_conv = AcceptChannel_read(ser_ref);
44998         FREE(ser);
44999         return tag_ptr(ret_conv, true);
45000 }
45001
45002 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
45003         LDKAcceptChannelV2 obj_conv;
45004         obj_conv.inner = untag_ptr(obj);
45005         obj_conv.is_owned = ptr_is_owned(obj);
45006         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45007         obj_conv.is_owned = false;
45008         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
45009         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45010         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45011         CVec_u8Z_free(ret_var);
45012         return ret_arr;
45013 }
45014
45015 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
45016         LDKu8slice ser_ref;
45017         ser_ref.datalen = ser->arr_len;
45018         ser_ref.data = ser->elems;
45019         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
45020         *ret_conv = AcceptChannelV2_read(ser_ref);
45021         FREE(ser);
45022         return tag_ptr(ret_conv, true);
45023 }
45024
45025 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
45026         LDKTxAddInput obj_conv;
45027         obj_conv.inner = untag_ptr(obj);
45028         obj_conv.is_owned = ptr_is_owned(obj);
45029         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45030         obj_conv.is_owned = false;
45031         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
45032         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45033         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45034         CVec_u8Z_free(ret_var);
45035         return ret_arr;
45036 }
45037
45038 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
45039         LDKu8slice ser_ref;
45040         ser_ref.datalen = ser->arr_len;
45041         ser_ref.data = ser->elems;
45042         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
45043         *ret_conv = TxAddInput_read(ser_ref);
45044         FREE(ser);
45045         return tag_ptr(ret_conv, true);
45046 }
45047
45048 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
45049         LDKTxAddOutput obj_conv;
45050         obj_conv.inner = untag_ptr(obj);
45051         obj_conv.is_owned = ptr_is_owned(obj);
45052         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45053         obj_conv.is_owned = false;
45054         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
45055         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45056         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45057         CVec_u8Z_free(ret_var);
45058         return ret_arr;
45059 }
45060
45061 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
45062         LDKu8slice ser_ref;
45063         ser_ref.datalen = ser->arr_len;
45064         ser_ref.data = ser->elems;
45065         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
45066         *ret_conv = TxAddOutput_read(ser_ref);
45067         FREE(ser);
45068         return tag_ptr(ret_conv, true);
45069 }
45070
45071 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
45072         LDKTxRemoveInput obj_conv;
45073         obj_conv.inner = untag_ptr(obj);
45074         obj_conv.is_owned = ptr_is_owned(obj);
45075         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45076         obj_conv.is_owned = false;
45077         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
45078         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45079         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45080         CVec_u8Z_free(ret_var);
45081         return ret_arr;
45082 }
45083
45084 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
45085         LDKu8slice ser_ref;
45086         ser_ref.datalen = ser->arr_len;
45087         ser_ref.data = ser->elems;
45088         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
45089         *ret_conv = TxRemoveInput_read(ser_ref);
45090         FREE(ser);
45091         return tag_ptr(ret_conv, true);
45092 }
45093
45094 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
45095         LDKTxRemoveOutput obj_conv;
45096         obj_conv.inner = untag_ptr(obj);
45097         obj_conv.is_owned = ptr_is_owned(obj);
45098         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45099         obj_conv.is_owned = false;
45100         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
45101         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45102         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45103         CVec_u8Z_free(ret_var);
45104         return ret_arr;
45105 }
45106
45107 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
45108         LDKu8slice ser_ref;
45109         ser_ref.datalen = ser->arr_len;
45110         ser_ref.data = ser->elems;
45111         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
45112         *ret_conv = TxRemoveOutput_read(ser_ref);
45113         FREE(ser);
45114         return tag_ptr(ret_conv, true);
45115 }
45116
45117 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
45118         LDKTxComplete obj_conv;
45119         obj_conv.inner = untag_ptr(obj);
45120         obj_conv.is_owned = ptr_is_owned(obj);
45121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45122         obj_conv.is_owned = false;
45123         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
45124         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45125         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45126         CVec_u8Z_free(ret_var);
45127         return ret_arr;
45128 }
45129
45130 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
45131         LDKu8slice ser_ref;
45132         ser_ref.datalen = ser->arr_len;
45133         ser_ref.data = ser->elems;
45134         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
45135         *ret_conv = TxComplete_read(ser_ref);
45136         FREE(ser);
45137         return tag_ptr(ret_conv, true);
45138 }
45139
45140 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
45141         LDKTxSignatures obj_conv;
45142         obj_conv.inner = untag_ptr(obj);
45143         obj_conv.is_owned = ptr_is_owned(obj);
45144         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45145         obj_conv.is_owned = false;
45146         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
45147         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45148         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45149         CVec_u8Z_free(ret_var);
45150         return ret_arr;
45151 }
45152
45153 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
45154         LDKu8slice ser_ref;
45155         ser_ref.datalen = ser->arr_len;
45156         ser_ref.data = ser->elems;
45157         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
45158         *ret_conv = TxSignatures_read(ser_ref);
45159         FREE(ser);
45160         return tag_ptr(ret_conv, true);
45161 }
45162
45163 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
45164         LDKTxInitRbf obj_conv;
45165         obj_conv.inner = untag_ptr(obj);
45166         obj_conv.is_owned = ptr_is_owned(obj);
45167         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45168         obj_conv.is_owned = false;
45169         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
45170         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45171         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45172         CVec_u8Z_free(ret_var);
45173         return ret_arr;
45174 }
45175
45176 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
45177         LDKu8slice ser_ref;
45178         ser_ref.datalen = ser->arr_len;
45179         ser_ref.data = ser->elems;
45180         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
45181         *ret_conv = TxInitRbf_read(ser_ref);
45182         FREE(ser);
45183         return tag_ptr(ret_conv, true);
45184 }
45185
45186 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
45187         LDKTxAckRbf obj_conv;
45188         obj_conv.inner = untag_ptr(obj);
45189         obj_conv.is_owned = ptr_is_owned(obj);
45190         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45191         obj_conv.is_owned = false;
45192         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
45193         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45194         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45195         CVec_u8Z_free(ret_var);
45196         return ret_arr;
45197 }
45198
45199 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
45200         LDKu8slice ser_ref;
45201         ser_ref.datalen = ser->arr_len;
45202         ser_ref.data = ser->elems;
45203         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
45204         *ret_conv = TxAckRbf_read(ser_ref);
45205         FREE(ser);
45206         return tag_ptr(ret_conv, true);
45207 }
45208
45209 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
45210         LDKTxAbort obj_conv;
45211         obj_conv.inner = untag_ptr(obj);
45212         obj_conv.is_owned = ptr_is_owned(obj);
45213         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45214         obj_conv.is_owned = false;
45215         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
45216         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45217         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45218         CVec_u8Z_free(ret_var);
45219         return ret_arr;
45220 }
45221
45222 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
45223         LDKu8slice ser_ref;
45224         ser_ref.datalen = ser->arr_len;
45225         ser_ref.data = ser->elems;
45226         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
45227         *ret_conv = TxAbort_read(ser_ref);
45228         FREE(ser);
45229         return tag_ptr(ret_conv, true);
45230 }
45231
45232 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
45233         LDKAnnouncementSignatures obj_conv;
45234         obj_conv.inner = untag_ptr(obj);
45235         obj_conv.is_owned = ptr_is_owned(obj);
45236         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45237         obj_conv.is_owned = false;
45238         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
45239         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45240         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45241         CVec_u8Z_free(ret_var);
45242         return ret_arr;
45243 }
45244
45245 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
45246         LDKu8slice ser_ref;
45247         ser_ref.datalen = ser->arr_len;
45248         ser_ref.data = ser->elems;
45249         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
45250         *ret_conv = AnnouncementSignatures_read(ser_ref);
45251         FREE(ser);
45252         return tag_ptr(ret_conv, true);
45253 }
45254
45255 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
45256         LDKChannelReestablish obj_conv;
45257         obj_conv.inner = untag_ptr(obj);
45258         obj_conv.is_owned = ptr_is_owned(obj);
45259         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45260         obj_conv.is_owned = false;
45261         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
45262         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45263         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45264         CVec_u8Z_free(ret_var);
45265         return ret_arr;
45266 }
45267
45268 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
45269         LDKu8slice ser_ref;
45270         ser_ref.datalen = ser->arr_len;
45271         ser_ref.data = ser->elems;
45272         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
45273         *ret_conv = ChannelReestablish_read(ser_ref);
45274         FREE(ser);
45275         return tag_ptr(ret_conv, true);
45276 }
45277
45278 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
45279         LDKClosingSigned obj_conv;
45280         obj_conv.inner = untag_ptr(obj);
45281         obj_conv.is_owned = ptr_is_owned(obj);
45282         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45283         obj_conv.is_owned = false;
45284         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
45285         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45286         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45287         CVec_u8Z_free(ret_var);
45288         return ret_arr;
45289 }
45290
45291 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
45292         LDKu8slice ser_ref;
45293         ser_ref.datalen = ser->arr_len;
45294         ser_ref.data = ser->elems;
45295         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
45296         *ret_conv = ClosingSigned_read(ser_ref);
45297         FREE(ser);
45298         return tag_ptr(ret_conv, true);
45299 }
45300
45301 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
45302         LDKClosingSignedFeeRange obj_conv;
45303         obj_conv.inner = untag_ptr(obj);
45304         obj_conv.is_owned = ptr_is_owned(obj);
45305         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45306         obj_conv.is_owned = false;
45307         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
45308         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45309         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45310         CVec_u8Z_free(ret_var);
45311         return ret_arr;
45312 }
45313
45314 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
45315         LDKu8slice ser_ref;
45316         ser_ref.datalen = ser->arr_len;
45317         ser_ref.data = ser->elems;
45318         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
45319         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
45320         FREE(ser);
45321         return tag_ptr(ret_conv, true);
45322 }
45323
45324 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
45325         LDKCommitmentSigned obj_conv;
45326         obj_conv.inner = untag_ptr(obj);
45327         obj_conv.is_owned = ptr_is_owned(obj);
45328         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45329         obj_conv.is_owned = false;
45330         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
45331         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45332         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45333         CVec_u8Z_free(ret_var);
45334         return ret_arr;
45335 }
45336
45337 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
45338         LDKu8slice ser_ref;
45339         ser_ref.datalen = ser->arr_len;
45340         ser_ref.data = ser->elems;
45341         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
45342         *ret_conv = CommitmentSigned_read(ser_ref);
45343         FREE(ser);
45344         return tag_ptr(ret_conv, true);
45345 }
45346
45347 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
45348         LDKFundingCreated obj_conv;
45349         obj_conv.inner = untag_ptr(obj);
45350         obj_conv.is_owned = ptr_is_owned(obj);
45351         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45352         obj_conv.is_owned = false;
45353         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
45354         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45355         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45356         CVec_u8Z_free(ret_var);
45357         return ret_arr;
45358 }
45359
45360 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
45361         LDKu8slice ser_ref;
45362         ser_ref.datalen = ser->arr_len;
45363         ser_ref.data = ser->elems;
45364         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
45365         *ret_conv = FundingCreated_read(ser_ref);
45366         FREE(ser);
45367         return tag_ptr(ret_conv, true);
45368 }
45369
45370 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
45371         LDKFundingSigned obj_conv;
45372         obj_conv.inner = untag_ptr(obj);
45373         obj_conv.is_owned = ptr_is_owned(obj);
45374         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45375         obj_conv.is_owned = false;
45376         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
45377         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45378         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45379         CVec_u8Z_free(ret_var);
45380         return ret_arr;
45381 }
45382
45383 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
45384         LDKu8slice ser_ref;
45385         ser_ref.datalen = ser->arr_len;
45386         ser_ref.data = ser->elems;
45387         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
45388         *ret_conv = FundingSigned_read(ser_ref);
45389         FREE(ser);
45390         return tag_ptr(ret_conv, true);
45391 }
45392
45393 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
45394         LDKChannelReady obj_conv;
45395         obj_conv.inner = untag_ptr(obj);
45396         obj_conv.is_owned = ptr_is_owned(obj);
45397         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45398         obj_conv.is_owned = false;
45399         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
45400         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45401         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45402         CVec_u8Z_free(ret_var);
45403         return ret_arr;
45404 }
45405
45406 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
45407         LDKu8slice ser_ref;
45408         ser_ref.datalen = ser->arr_len;
45409         ser_ref.data = ser->elems;
45410         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
45411         *ret_conv = ChannelReady_read(ser_ref);
45412         FREE(ser);
45413         return tag_ptr(ret_conv, true);
45414 }
45415
45416 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
45417         LDKInit obj_conv;
45418         obj_conv.inner = untag_ptr(obj);
45419         obj_conv.is_owned = ptr_is_owned(obj);
45420         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45421         obj_conv.is_owned = false;
45422         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
45423         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45424         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45425         CVec_u8Z_free(ret_var);
45426         return ret_arr;
45427 }
45428
45429 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
45430         LDKu8slice ser_ref;
45431         ser_ref.datalen = ser->arr_len;
45432         ser_ref.data = ser->elems;
45433         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
45434         *ret_conv = Init_read(ser_ref);
45435         FREE(ser);
45436         return tag_ptr(ret_conv, true);
45437 }
45438
45439 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
45440         LDKOpenChannel obj_conv;
45441         obj_conv.inner = untag_ptr(obj);
45442         obj_conv.is_owned = ptr_is_owned(obj);
45443         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45444         obj_conv.is_owned = false;
45445         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
45446         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45447         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45448         CVec_u8Z_free(ret_var);
45449         return ret_arr;
45450 }
45451
45452 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
45453         LDKu8slice ser_ref;
45454         ser_ref.datalen = ser->arr_len;
45455         ser_ref.data = ser->elems;
45456         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
45457         *ret_conv = OpenChannel_read(ser_ref);
45458         FREE(ser);
45459         return tag_ptr(ret_conv, true);
45460 }
45461
45462 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
45463         LDKOpenChannelV2 obj_conv;
45464         obj_conv.inner = untag_ptr(obj);
45465         obj_conv.is_owned = ptr_is_owned(obj);
45466         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45467         obj_conv.is_owned = false;
45468         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_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         CVec_u8Z_free(ret_var);
45472         return ret_arr;
45473 }
45474
45475 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
45476         LDKu8slice ser_ref;
45477         ser_ref.datalen = ser->arr_len;
45478         ser_ref.data = ser->elems;
45479         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
45480         *ret_conv = OpenChannelV2_read(ser_ref);
45481         FREE(ser);
45482         return tag_ptr(ret_conv, true);
45483 }
45484
45485 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
45486         LDKRevokeAndACK obj_conv;
45487         obj_conv.inner = untag_ptr(obj);
45488         obj_conv.is_owned = ptr_is_owned(obj);
45489         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45490         obj_conv.is_owned = false;
45491         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
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 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
45499         LDKu8slice ser_ref;
45500         ser_ref.datalen = ser->arr_len;
45501         ser_ref.data = ser->elems;
45502         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
45503         *ret_conv = RevokeAndACK_read(ser_ref);
45504         FREE(ser);
45505         return tag_ptr(ret_conv, true);
45506 }
45507
45508 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
45509         LDKShutdown obj_conv;
45510         obj_conv.inner = untag_ptr(obj);
45511         obj_conv.is_owned = ptr_is_owned(obj);
45512         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45513         obj_conv.is_owned = false;
45514         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
45515         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45516         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45517         CVec_u8Z_free(ret_var);
45518         return ret_arr;
45519 }
45520
45521 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
45522         LDKu8slice ser_ref;
45523         ser_ref.datalen = ser->arr_len;
45524         ser_ref.data = ser->elems;
45525         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
45526         *ret_conv = Shutdown_read(ser_ref);
45527         FREE(ser);
45528         return tag_ptr(ret_conv, true);
45529 }
45530
45531 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
45532         LDKUpdateFailHTLC obj_conv;
45533         obj_conv.inner = untag_ptr(obj);
45534         obj_conv.is_owned = ptr_is_owned(obj);
45535         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45536         obj_conv.is_owned = false;
45537         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
45538         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45539         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45540         CVec_u8Z_free(ret_var);
45541         return ret_arr;
45542 }
45543
45544 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
45545         LDKu8slice ser_ref;
45546         ser_ref.datalen = ser->arr_len;
45547         ser_ref.data = ser->elems;
45548         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
45549         *ret_conv = UpdateFailHTLC_read(ser_ref);
45550         FREE(ser);
45551         return tag_ptr(ret_conv, true);
45552 }
45553
45554 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
45555         LDKUpdateFailMalformedHTLC obj_conv;
45556         obj_conv.inner = untag_ptr(obj);
45557         obj_conv.is_owned = ptr_is_owned(obj);
45558         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45559         obj_conv.is_owned = false;
45560         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
45561         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45562         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45563         CVec_u8Z_free(ret_var);
45564         return ret_arr;
45565 }
45566
45567 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
45568         LDKu8slice ser_ref;
45569         ser_ref.datalen = ser->arr_len;
45570         ser_ref.data = ser->elems;
45571         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
45572         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
45573         FREE(ser);
45574         return tag_ptr(ret_conv, true);
45575 }
45576
45577 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
45578         LDKUpdateFee obj_conv;
45579         obj_conv.inner = untag_ptr(obj);
45580         obj_conv.is_owned = ptr_is_owned(obj);
45581         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45582         obj_conv.is_owned = false;
45583         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
45584         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45585         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45586         CVec_u8Z_free(ret_var);
45587         return ret_arr;
45588 }
45589
45590 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
45591         LDKu8slice ser_ref;
45592         ser_ref.datalen = ser->arr_len;
45593         ser_ref.data = ser->elems;
45594         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
45595         *ret_conv = UpdateFee_read(ser_ref);
45596         FREE(ser);
45597         return tag_ptr(ret_conv, true);
45598 }
45599
45600 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
45601         LDKUpdateFulfillHTLC obj_conv;
45602         obj_conv.inner = untag_ptr(obj);
45603         obj_conv.is_owned = ptr_is_owned(obj);
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45605         obj_conv.is_owned = false;
45606         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
45607         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45608         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45609         CVec_u8Z_free(ret_var);
45610         return ret_arr;
45611 }
45612
45613 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
45614         LDKu8slice ser_ref;
45615         ser_ref.datalen = ser->arr_len;
45616         ser_ref.data = ser->elems;
45617         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
45618         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
45619         FREE(ser);
45620         return tag_ptr(ret_conv, true);
45621 }
45622
45623 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
45624         LDKUpdateAddHTLC obj_conv;
45625         obj_conv.inner = untag_ptr(obj);
45626         obj_conv.is_owned = ptr_is_owned(obj);
45627         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45628         obj_conv.is_owned = false;
45629         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
45630         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45631         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45632         CVec_u8Z_free(ret_var);
45633         return ret_arr;
45634 }
45635
45636 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
45637         LDKu8slice ser_ref;
45638         ser_ref.datalen = ser->arr_len;
45639         ser_ref.data = ser->elems;
45640         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
45641         *ret_conv = UpdateAddHTLC_read(ser_ref);
45642         FREE(ser);
45643         return tag_ptr(ret_conv, true);
45644 }
45645
45646 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
45647         LDKu8slice ser_ref;
45648         ser_ref.datalen = ser->arr_len;
45649         ser_ref.data = ser->elems;
45650         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
45651         *ret_conv = OnionMessage_read(ser_ref);
45652         FREE(ser);
45653         return tag_ptr(ret_conv, true);
45654 }
45655
45656 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
45657         LDKOnionMessage obj_conv;
45658         obj_conv.inner = untag_ptr(obj);
45659         obj_conv.is_owned = ptr_is_owned(obj);
45660         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45661         obj_conv.is_owned = false;
45662         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
45663         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45664         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45665         CVec_u8Z_free(ret_var);
45666         return ret_arr;
45667 }
45668
45669 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
45670         LDKPing obj_conv;
45671         obj_conv.inner = untag_ptr(obj);
45672         obj_conv.is_owned = ptr_is_owned(obj);
45673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45674         obj_conv.is_owned = false;
45675         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
45676         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45677         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45678         CVec_u8Z_free(ret_var);
45679         return ret_arr;
45680 }
45681
45682 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
45683         LDKu8slice ser_ref;
45684         ser_ref.datalen = ser->arr_len;
45685         ser_ref.data = ser->elems;
45686         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
45687         *ret_conv = Ping_read(ser_ref);
45688         FREE(ser);
45689         return tag_ptr(ret_conv, true);
45690 }
45691
45692 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
45693         LDKPong obj_conv;
45694         obj_conv.inner = untag_ptr(obj);
45695         obj_conv.is_owned = ptr_is_owned(obj);
45696         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45697         obj_conv.is_owned = false;
45698         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
45699         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45700         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45701         CVec_u8Z_free(ret_var);
45702         return ret_arr;
45703 }
45704
45705 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
45706         LDKu8slice ser_ref;
45707         ser_ref.datalen = ser->arr_len;
45708         ser_ref.data = ser->elems;
45709         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
45710         *ret_conv = Pong_read(ser_ref);
45711         FREE(ser);
45712         return tag_ptr(ret_conv, true);
45713 }
45714
45715 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
45716         LDKUnsignedChannelAnnouncement obj_conv;
45717         obj_conv.inner = untag_ptr(obj);
45718         obj_conv.is_owned = ptr_is_owned(obj);
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45720         obj_conv.is_owned = false;
45721         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
45722         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45723         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45724         CVec_u8Z_free(ret_var);
45725         return ret_arr;
45726 }
45727
45728 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
45729         LDKu8slice ser_ref;
45730         ser_ref.datalen = ser->arr_len;
45731         ser_ref.data = ser->elems;
45732         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
45733         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
45734         FREE(ser);
45735         return tag_ptr(ret_conv, true);
45736 }
45737
45738 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
45739         LDKChannelAnnouncement obj_conv;
45740         obj_conv.inner = untag_ptr(obj);
45741         obj_conv.is_owned = ptr_is_owned(obj);
45742         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45743         obj_conv.is_owned = false;
45744         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
45745         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45746         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45747         CVec_u8Z_free(ret_var);
45748         return ret_arr;
45749 }
45750
45751 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
45752         LDKu8slice ser_ref;
45753         ser_ref.datalen = ser->arr_len;
45754         ser_ref.data = ser->elems;
45755         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
45756         *ret_conv = ChannelAnnouncement_read(ser_ref);
45757         FREE(ser);
45758         return tag_ptr(ret_conv, true);
45759 }
45760
45761 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
45762         LDKUnsignedChannelUpdate obj_conv;
45763         obj_conv.inner = untag_ptr(obj);
45764         obj_conv.is_owned = ptr_is_owned(obj);
45765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45766         obj_conv.is_owned = false;
45767         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
45768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45770         CVec_u8Z_free(ret_var);
45771         return ret_arr;
45772 }
45773
45774 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
45775         LDKu8slice ser_ref;
45776         ser_ref.datalen = ser->arr_len;
45777         ser_ref.data = ser->elems;
45778         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
45779         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
45780         FREE(ser);
45781         return tag_ptr(ret_conv, true);
45782 }
45783
45784 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
45785         LDKChannelUpdate obj_conv;
45786         obj_conv.inner = untag_ptr(obj);
45787         obj_conv.is_owned = ptr_is_owned(obj);
45788         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45789         obj_conv.is_owned = false;
45790         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
45791         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45792         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45793         CVec_u8Z_free(ret_var);
45794         return ret_arr;
45795 }
45796
45797 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
45798         LDKu8slice ser_ref;
45799         ser_ref.datalen = ser->arr_len;
45800         ser_ref.data = ser->elems;
45801         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
45802         *ret_conv = ChannelUpdate_read(ser_ref);
45803         FREE(ser);
45804         return tag_ptr(ret_conv, true);
45805 }
45806
45807 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
45808         LDKErrorMessage obj_conv;
45809         obj_conv.inner = untag_ptr(obj);
45810         obj_conv.is_owned = ptr_is_owned(obj);
45811         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45812         obj_conv.is_owned = false;
45813         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
45814         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45815         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45816         CVec_u8Z_free(ret_var);
45817         return ret_arr;
45818 }
45819
45820 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
45821         LDKu8slice ser_ref;
45822         ser_ref.datalen = ser->arr_len;
45823         ser_ref.data = ser->elems;
45824         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
45825         *ret_conv = ErrorMessage_read(ser_ref);
45826         FREE(ser);
45827         return tag_ptr(ret_conv, true);
45828 }
45829
45830 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
45831         LDKWarningMessage obj_conv;
45832         obj_conv.inner = untag_ptr(obj);
45833         obj_conv.is_owned = ptr_is_owned(obj);
45834         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45835         obj_conv.is_owned = false;
45836         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
45837         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45838         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45839         CVec_u8Z_free(ret_var);
45840         return ret_arr;
45841 }
45842
45843 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
45844         LDKu8slice ser_ref;
45845         ser_ref.datalen = ser->arr_len;
45846         ser_ref.data = ser->elems;
45847         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
45848         *ret_conv = WarningMessage_read(ser_ref);
45849         FREE(ser);
45850         return tag_ptr(ret_conv, true);
45851 }
45852
45853 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
45854         LDKUnsignedNodeAnnouncement obj_conv;
45855         obj_conv.inner = untag_ptr(obj);
45856         obj_conv.is_owned = ptr_is_owned(obj);
45857         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45858         obj_conv.is_owned = false;
45859         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
45860         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45861         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45862         CVec_u8Z_free(ret_var);
45863         return ret_arr;
45864 }
45865
45866 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
45867         LDKu8slice ser_ref;
45868         ser_ref.datalen = ser->arr_len;
45869         ser_ref.data = ser->elems;
45870         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
45871         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
45872         FREE(ser);
45873         return tag_ptr(ret_conv, true);
45874 }
45875
45876 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
45877         LDKNodeAnnouncement obj_conv;
45878         obj_conv.inner = untag_ptr(obj);
45879         obj_conv.is_owned = ptr_is_owned(obj);
45880         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45881         obj_conv.is_owned = false;
45882         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
45883         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45884         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45885         CVec_u8Z_free(ret_var);
45886         return ret_arr;
45887 }
45888
45889 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
45890         LDKu8slice ser_ref;
45891         ser_ref.datalen = ser->arr_len;
45892         ser_ref.data = ser->elems;
45893         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
45894         *ret_conv = NodeAnnouncement_read(ser_ref);
45895         FREE(ser);
45896         return tag_ptr(ret_conv, true);
45897 }
45898
45899 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
45900         LDKu8slice ser_ref;
45901         ser_ref.datalen = ser->arr_len;
45902         ser_ref.data = ser->elems;
45903         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
45904         *ret_conv = QueryShortChannelIds_read(ser_ref);
45905         FREE(ser);
45906         return tag_ptr(ret_conv, true);
45907 }
45908
45909 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
45910         LDKQueryShortChannelIds obj_conv;
45911         obj_conv.inner = untag_ptr(obj);
45912         obj_conv.is_owned = ptr_is_owned(obj);
45913         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45914         obj_conv.is_owned = false;
45915         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
45916         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45917         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45918         CVec_u8Z_free(ret_var);
45919         return ret_arr;
45920 }
45921
45922 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
45923         LDKReplyShortChannelIdsEnd obj_conv;
45924         obj_conv.inner = untag_ptr(obj);
45925         obj_conv.is_owned = ptr_is_owned(obj);
45926         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45927         obj_conv.is_owned = false;
45928         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
45929         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45930         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45931         CVec_u8Z_free(ret_var);
45932         return ret_arr;
45933 }
45934
45935 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
45936         LDKu8slice ser_ref;
45937         ser_ref.datalen = ser->arr_len;
45938         ser_ref.data = ser->elems;
45939         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
45940         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
45941         FREE(ser);
45942         return tag_ptr(ret_conv, true);
45943 }
45944
45945 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
45946         LDKQueryChannelRange this_arg_conv;
45947         this_arg_conv.inner = untag_ptr(this_arg);
45948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45950         this_arg_conv.is_owned = false;
45951         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
45952         return ret_conv;
45953 }
45954
45955 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
45956         LDKQueryChannelRange obj_conv;
45957         obj_conv.inner = untag_ptr(obj);
45958         obj_conv.is_owned = ptr_is_owned(obj);
45959         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45960         obj_conv.is_owned = false;
45961         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
45962         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45963         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45964         CVec_u8Z_free(ret_var);
45965         return ret_arr;
45966 }
45967
45968 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
45969         LDKu8slice ser_ref;
45970         ser_ref.datalen = ser->arr_len;
45971         ser_ref.data = ser->elems;
45972         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
45973         *ret_conv = QueryChannelRange_read(ser_ref);
45974         FREE(ser);
45975         return tag_ptr(ret_conv, true);
45976 }
45977
45978 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
45979         LDKu8slice ser_ref;
45980         ser_ref.datalen = ser->arr_len;
45981         ser_ref.data = ser->elems;
45982         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
45983         *ret_conv = ReplyChannelRange_read(ser_ref);
45984         FREE(ser);
45985         return tag_ptr(ret_conv, true);
45986 }
45987
45988 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
45989         LDKReplyChannelRange obj_conv;
45990         obj_conv.inner = untag_ptr(obj);
45991         obj_conv.is_owned = ptr_is_owned(obj);
45992         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45993         obj_conv.is_owned = false;
45994         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
45995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45997         CVec_u8Z_free(ret_var);
45998         return ret_arr;
45999 }
46000
46001 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
46002         LDKGossipTimestampFilter obj_conv;
46003         obj_conv.inner = untag_ptr(obj);
46004         obj_conv.is_owned = ptr_is_owned(obj);
46005         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46006         obj_conv.is_owned = false;
46007         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
46008         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46009         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46010         CVec_u8Z_free(ret_var);
46011         return ret_arr;
46012 }
46013
46014 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
46015         LDKu8slice ser_ref;
46016         ser_ref.datalen = ser->arr_len;
46017         ser_ref.data = ser->elems;
46018         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
46019         *ret_conv = GossipTimestampFilter_read(ser_ref);
46020         FREE(ser);
46021         return tag_ptr(ret_conv, true);
46022 }
46023
46024 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
46025         if (!ptr_is_owned(this_ptr)) return;
46026         void* this_ptr_ptr = untag_ptr(this_ptr);
46027         CHECK_ACCESS(this_ptr_ptr);
46028         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
46029         FREE(untag_ptr(this_ptr));
46030         CustomMessageHandler_free(this_ptr_conv);
46031 }
46032
46033 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
46034         LDKIgnoringMessageHandler this_obj_conv;
46035         this_obj_conv.inner = untag_ptr(this_obj);
46036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46038         IgnoringMessageHandler_free(this_obj_conv);
46039 }
46040
46041 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
46042         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
46043         uint64_t ret_ref = 0;
46044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46046         return ret_ref;
46047 }
46048
46049 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
46050         LDKIgnoringMessageHandler this_arg_conv;
46051         this_arg_conv.inner = untag_ptr(this_arg);
46052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46054         this_arg_conv.is_owned = false;
46055         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
46056         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
46057         return tag_ptr(ret_ret, true);
46058 }
46059
46060 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
46061         LDKIgnoringMessageHandler this_arg_conv;
46062         this_arg_conv.inner = untag_ptr(this_arg);
46063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46065         this_arg_conv.is_owned = false;
46066         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
46067         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
46068         return tag_ptr(ret_ret, true);
46069 }
46070
46071 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
46072         LDKIgnoringMessageHandler this_arg_conv;
46073         this_arg_conv.inner = untag_ptr(this_arg);
46074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46076         this_arg_conv.is_owned = false;
46077         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
46078         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
46079         return tag_ptr(ret_ret, true);
46080 }
46081
46082 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
46083         LDKIgnoringMessageHandler this_arg_conv;
46084         this_arg_conv.inner = untag_ptr(this_arg);
46085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46087         this_arg_conv.is_owned = false;
46088         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
46089         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
46090         return tag_ptr(ret_ret, true);
46091 }
46092
46093 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
46094         LDKIgnoringMessageHandler this_arg_conv;
46095         this_arg_conv.inner = untag_ptr(this_arg);
46096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46098         this_arg_conv.is_owned = false;
46099         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
46100         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
46101         return tag_ptr(ret_ret, true);
46102 }
46103
46104 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
46105         LDKIgnoringMessageHandler this_arg_conv;
46106         this_arg_conv.inner = untag_ptr(this_arg);
46107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46109         this_arg_conv.is_owned = false;
46110         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
46111         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
46112         return tag_ptr(ret_ret, true);
46113 }
46114
46115 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
46116         LDKIgnoringMessageHandler this_arg_conv;
46117         this_arg_conv.inner = untag_ptr(this_arg);
46118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46120         this_arg_conv.is_owned = false;
46121         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
46122         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
46123         return tag_ptr(ret_ret, true);
46124 }
46125
46126 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
46127         LDKIgnoringMessageHandler this_arg_conv;
46128         this_arg_conv.inner = untag_ptr(this_arg);
46129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46131         this_arg_conv.is_owned = false;
46132         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
46133         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
46134         return tag_ptr(ret_ret, true);
46135 }
46136
46137 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
46138         LDKErroringMessageHandler this_obj_conv;
46139         this_obj_conv.inner = untag_ptr(this_obj);
46140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46142         ErroringMessageHandler_free(this_obj_conv);
46143 }
46144
46145 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
46146         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
46147         uint64_t ret_ref = 0;
46148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46150         return ret_ref;
46151 }
46152
46153 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
46154         LDKErroringMessageHandler this_arg_conv;
46155         this_arg_conv.inner = untag_ptr(this_arg);
46156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46158         this_arg_conv.is_owned = false;
46159         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
46160         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
46161         return tag_ptr(ret_ret, true);
46162 }
46163
46164 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
46165         LDKErroringMessageHandler this_arg_conv;
46166         this_arg_conv.inner = untag_ptr(this_arg);
46167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46169         this_arg_conv.is_owned = false;
46170         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
46171         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
46172         return tag_ptr(ret_ret, true);
46173 }
46174
46175 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
46176         LDKMessageHandler this_obj_conv;
46177         this_obj_conv.inner = untag_ptr(this_obj);
46178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46180         MessageHandler_free(this_obj_conv);
46181 }
46182
46183 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
46184         LDKMessageHandler this_ptr_conv;
46185         this_ptr_conv.inner = untag_ptr(this_ptr);
46186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46188         this_ptr_conv.is_owned = false;
46189         // WARNING: This object doesn't live past this scope, needs clone!
46190         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
46191         return ret_ret;
46192 }
46193
46194 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
46195         LDKMessageHandler this_ptr_conv;
46196         this_ptr_conv.inner = untag_ptr(this_ptr);
46197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46199         this_ptr_conv.is_owned = false;
46200         void* val_ptr = untag_ptr(val);
46201         CHECK_ACCESS(val_ptr);
46202         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
46203         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
46204                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46205                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
46206         }
46207         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
46208 }
46209
46210 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
46211         LDKMessageHandler this_ptr_conv;
46212         this_ptr_conv.inner = untag_ptr(this_ptr);
46213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46215         this_ptr_conv.is_owned = false;
46216         // WARNING: This object doesn't live past this scope, needs clone!
46217         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
46218         return ret_ret;
46219 }
46220
46221 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
46222         LDKMessageHandler this_ptr_conv;
46223         this_ptr_conv.inner = untag_ptr(this_ptr);
46224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46226         this_ptr_conv.is_owned = false;
46227         void* val_ptr = untag_ptr(val);
46228         CHECK_ACCESS(val_ptr);
46229         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
46230         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
46231                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46232                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
46233         }
46234         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
46235 }
46236
46237 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
46238         LDKMessageHandler this_ptr_conv;
46239         this_ptr_conv.inner = untag_ptr(this_ptr);
46240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46242         this_ptr_conv.is_owned = false;
46243         // WARNING: This object doesn't live past this scope, needs clone!
46244         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
46245         return ret_ret;
46246 }
46247
46248 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
46249         LDKMessageHandler this_ptr_conv;
46250         this_ptr_conv.inner = untag_ptr(this_ptr);
46251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46253         this_ptr_conv.is_owned = false;
46254         void* val_ptr = untag_ptr(val);
46255         CHECK_ACCESS(val_ptr);
46256         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
46257         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
46258                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46259                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
46260         }
46261         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
46262 }
46263
46264 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
46265         LDKMessageHandler this_ptr_conv;
46266         this_ptr_conv.inner = untag_ptr(this_ptr);
46267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46269         this_ptr_conv.is_owned = false;
46270         // WARNING: This object doesn't live past this scope, needs clone!
46271         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
46272         return ret_ret;
46273 }
46274
46275 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
46276         LDKMessageHandler this_ptr_conv;
46277         this_ptr_conv.inner = untag_ptr(this_ptr);
46278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46280         this_ptr_conv.is_owned = false;
46281         void* val_ptr = untag_ptr(val);
46282         CHECK_ACCESS(val_ptr);
46283         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
46284         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
46285                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46286                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
46287         }
46288         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
46289 }
46290
46291 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) {
46292         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
46293         CHECK_ACCESS(chan_handler_arg_ptr);
46294         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
46295         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
46296                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46297                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
46298         }
46299         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
46300         CHECK_ACCESS(route_handler_arg_ptr);
46301         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
46302         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
46303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46304                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
46305         }
46306         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
46307         CHECK_ACCESS(onion_message_handler_arg_ptr);
46308         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
46309         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
46310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46311                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
46312         }
46313         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
46314         CHECK_ACCESS(custom_message_handler_arg_ptr);
46315         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
46316         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
46317                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46318                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
46319         }
46320         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
46321         uint64_t ret_ref = 0;
46322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46324         return ret_ref;
46325 }
46326
46327 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
46328         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
46329         *ret_ret = SocketDescriptor_clone(arg);
46330         return tag_ptr(ret_ret, true);
46331 }
46332 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
46333         void* arg_ptr = untag_ptr(arg);
46334         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
46335         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
46336         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
46337         return ret_conv;
46338 }
46339
46340 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
46341         void* orig_ptr = untag_ptr(orig);
46342         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
46343         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
46344         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
46345         *ret_ret = SocketDescriptor_clone(orig_conv);
46346         return tag_ptr(ret_ret, true);
46347 }
46348
46349 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
46350         if (!ptr_is_owned(this_ptr)) return;
46351         void* this_ptr_ptr = untag_ptr(this_ptr);
46352         CHECK_ACCESS(this_ptr_ptr);
46353         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
46354         FREE(untag_ptr(this_ptr));
46355         SocketDescriptor_free(this_ptr_conv);
46356 }
46357
46358 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
46359         LDKPeerHandleError this_obj_conv;
46360         this_obj_conv.inner = untag_ptr(this_obj);
46361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46363         PeerHandleError_free(this_obj_conv);
46364 }
46365
46366 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
46367         LDKPeerHandleError ret_var = PeerHandleError_new();
46368         uint64_t ret_ref = 0;
46369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46371         return ret_ref;
46372 }
46373
46374 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
46375         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
46376         uint64_t ret_ref = 0;
46377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46379         return ret_ref;
46380 }
46381 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
46382         LDKPeerHandleError arg_conv;
46383         arg_conv.inner = untag_ptr(arg);
46384         arg_conv.is_owned = ptr_is_owned(arg);
46385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46386         arg_conv.is_owned = false;
46387         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
46388         return ret_conv;
46389 }
46390
46391 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
46392         LDKPeerHandleError orig_conv;
46393         orig_conv.inner = untag_ptr(orig);
46394         orig_conv.is_owned = ptr_is_owned(orig);
46395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46396         orig_conv.is_owned = false;
46397         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
46398         uint64_t ret_ref = 0;
46399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46401         return ret_ref;
46402 }
46403
46404 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
46405         LDKPeerManager this_obj_conv;
46406         this_obj_conv.inner = untag_ptr(this_obj);
46407         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46409         PeerManager_free(this_obj_conv);
46410 }
46411
46412 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) {
46413         LDKMessageHandler message_handler_conv;
46414         message_handler_conv.inner = untag_ptr(message_handler);
46415         message_handler_conv.is_owned = ptr_is_owned(message_handler);
46416         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
46417         // WARNING: we need a move here but no clone is available for LDKMessageHandler
46418         
46419         uint8_t ephemeral_random_data_arr[32];
46420         CHECK(ephemeral_random_data->arr_len == 32);
46421         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
46422         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
46423         void* logger_ptr = untag_ptr(logger);
46424         CHECK_ACCESS(logger_ptr);
46425         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46426         if (logger_conv.free == LDKLogger_JCalls_free) {
46427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46428                 LDKLogger_JCalls_cloned(&logger_conv);
46429         }
46430         void* node_signer_ptr = untag_ptr(node_signer);
46431         CHECK_ACCESS(node_signer_ptr);
46432         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
46433         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
46434                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46435                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
46436         }
46437         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
46438         uint64_t ret_ref = 0;
46439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46441         return ret_ref;
46442 }
46443
46444 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
46445         LDKPeerManager this_arg_conv;
46446         this_arg_conv.inner = untag_ptr(this_arg);
46447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46449         this_arg_conv.is_owned = false;
46450         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
46451         uint64_tArray ret_arr = NULL;
46452         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46453         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46454         for (size_t r = 0; r < ret_var.datalen; r++) {
46455                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
46456                 *ret_conv_43_conv = ret_var.data[r];
46457                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
46458         }
46459         
46460         FREE(ret_var.data);
46461         return ret_arr;
46462 }
46463
46464 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) {
46465         LDKPeerManager this_arg_conv;
46466         this_arg_conv.inner = untag_ptr(this_arg);
46467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46469         this_arg_conv.is_owned = false;
46470         LDKPublicKey their_node_id_ref;
46471         CHECK(their_node_id->arr_len == 33);
46472         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
46473         void* descriptor_ptr = untag_ptr(descriptor);
46474         CHECK_ACCESS(descriptor_ptr);
46475         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
46476         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
46477                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46478                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
46479         }
46480         void* remote_network_address_ptr = untag_ptr(remote_network_address);
46481         CHECK_ACCESS(remote_network_address_ptr);
46482         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
46483         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
46484         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
46485         return tag_ptr(ret_conv, true);
46486 }
46487
46488 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) {
46489         LDKPeerManager this_arg_conv;
46490         this_arg_conv.inner = untag_ptr(this_arg);
46491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46493         this_arg_conv.is_owned = false;
46494         void* descriptor_ptr = untag_ptr(descriptor);
46495         CHECK_ACCESS(descriptor_ptr);
46496         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
46497         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
46498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46499                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
46500         }
46501         void* remote_network_address_ptr = untag_ptr(remote_network_address);
46502         CHECK_ACCESS(remote_network_address_ptr);
46503         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
46504         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
46505         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
46506         return tag_ptr(ret_conv, true);
46507 }
46508
46509 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
46510         LDKPeerManager this_arg_conv;
46511         this_arg_conv.inner = untag_ptr(this_arg);
46512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46514         this_arg_conv.is_owned = false;
46515         void* descriptor_ptr = untag_ptr(descriptor);
46516         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
46517         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
46518         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
46519         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
46520         return tag_ptr(ret_conv, true);
46521 }
46522
46523 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
46524         LDKPeerManager this_arg_conv;
46525         this_arg_conv.inner = untag_ptr(this_arg);
46526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46528         this_arg_conv.is_owned = false;
46529         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
46530         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
46531         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
46532         LDKu8slice data_ref;
46533         data_ref.datalen = data->arr_len;
46534         data_ref.data = data->elems;
46535         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
46536         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
46537         FREE(data);
46538         return tag_ptr(ret_conv, true);
46539 }
46540
46541 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
46542         LDKPeerManager this_arg_conv;
46543         this_arg_conv.inner = untag_ptr(this_arg);
46544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46546         this_arg_conv.is_owned = false;
46547         PeerManager_process_events(&this_arg_conv);
46548 }
46549
46550 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
46551         LDKPeerManager this_arg_conv;
46552         this_arg_conv.inner = untag_ptr(this_arg);
46553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46555         this_arg_conv.is_owned = false;
46556         void* descriptor_ptr = untag_ptr(descriptor);
46557         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
46558         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
46559         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
46560 }
46561
46562 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
46563         LDKPeerManager this_arg_conv;
46564         this_arg_conv.inner = untag_ptr(this_arg);
46565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46567         this_arg_conv.is_owned = false;
46568         LDKPublicKey node_id_ref;
46569         CHECK(node_id->arr_len == 33);
46570         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
46571         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
46572 }
46573
46574 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
46575         LDKPeerManager this_arg_conv;
46576         this_arg_conv.inner = untag_ptr(this_arg);
46577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46579         this_arg_conv.is_owned = false;
46580         PeerManager_disconnect_all_peers(&this_arg_conv);
46581 }
46582
46583 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
46584         LDKPeerManager this_arg_conv;
46585         this_arg_conv.inner = untag_ptr(this_arg);
46586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46588         this_arg_conv.is_owned = false;
46589         PeerManager_timer_tick_occurred(&this_arg_conv);
46590 }
46591
46592 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) {
46593         LDKPeerManager this_arg_conv;
46594         this_arg_conv.inner = untag_ptr(this_arg);
46595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46597         this_arg_conv.is_owned = false;
46598         LDKThreeBytes rgb_ref;
46599         CHECK(rgb->arr_len == 3);
46600         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
46601         LDKThirtyTwoBytes alias_ref;
46602         CHECK(alias->arr_len == 32);
46603         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
46604         LDKCVec_SocketAddressZ addresses_constr;
46605         addresses_constr.datalen = addresses->arr_len;
46606         if (addresses_constr.datalen > 0)
46607                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
46608         else
46609                 addresses_constr.data = NULL;
46610         uint64_t* addresses_vals = addresses->elems;
46611         for (size_t p = 0; p < addresses_constr.datalen; p++) {
46612                 uint64_t addresses_conv_15 = addresses_vals[p];
46613                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
46614                 CHECK_ACCESS(addresses_conv_15_ptr);
46615                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
46616                 addresses_constr.data[p] = addresses_conv_15_conv;
46617         }
46618         FREE(addresses);
46619         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
46620 }
46621
46622 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
46623         LDKChannelTypeFeatures channel_type_features_conv;
46624         channel_type_features_conv.inner = untag_ptr(channel_type_features);
46625         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
46626         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
46627         channel_type_features_conv.is_owned = false;
46628         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
46629         return ret_conv;
46630 }
46631
46632 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
46633         LDKChannelTypeFeatures channel_type_features_conv;
46634         channel_type_features_conv.inner = untag_ptr(channel_type_features);
46635         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
46636         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
46637         channel_type_features_conv.is_owned = false;
46638         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
46639         return ret_conv;
46640 }
46641
46642 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
46643         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
46644         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
46645         return ret_conv;
46646 }
46647
46648 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
46649         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
46650         return ret_conv;
46651 }
46652
46653 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
46654         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
46655         return ret_conv;
46656 }
46657
46658 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
46659         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
46660         return ret_conv;
46661 }
46662
46663 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
46664         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
46665         return ret_conv;
46666 }
46667
46668 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
46669         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
46670         return ret_conv;
46671 }
46672
46673 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
46674         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
46675         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
46676         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
46677         return ret_conv;
46678 }
46679
46680 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
46681         LDKWitness witness_ref;
46682         witness_ref.datalen = witness->arr_len;
46683         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
46684         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
46685         witness_ref.data_is_owned = true;
46686         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
46687         *ret_copy = HTLCClaim_from_witness(witness_ref);
46688         uint64_t ret_ref = tag_ptr(ret_copy, true);
46689         return ret_ref;
46690 }
46691
46692 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
46693         uint8_t commitment_seed_arr[32];
46694         CHECK(commitment_seed->arr_len == 32);
46695         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
46696         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
46697         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46698         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
46699         return ret_arr;
46700 }
46701
46702 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) {
46703         LDKCVec_u8Z to_holder_script_ref;
46704         to_holder_script_ref.datalen = to_holder_script->arr_len;
46705         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
46706         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
46707         LDKCVec_u8Z to_counterparty_script_ref;
46708         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
46709         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
46710         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
46711         LDKOutPoint funding_outpoint_conv;
46712         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
46713         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
46714         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
46715         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
46716         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);
46717         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46718         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46719         Transaction_free(ret_var);
46720         return ret_arr;
46721 }
46722
46723 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
46724         LDKCounterpartyCommitmentSecrets this_obj_conv;
46725         this_obj_conv.inner = untag_ptr(this_obj);
46726         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46728         CounterpartyCommitmentSecrets_free(this_obj_conv);
46729 }
46730
46731 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
46732         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
46733         uint64_t ret_ref = 0;
46734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46736         return ret_ref;
46737 }
46738 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
46739         LDKCounterpartyCommitmentSecrets arg_conv;
46740         arg_conv.inner = untag_ptr(arg);
46741         arg_conv.is_owned = ptr_is_owned(arg);
46742         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46743         arg_conv.is_owned = false;
46744         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
46745         return ret_conv;
46746 }
46747
46748 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
46749         LDKCounterpartyCommitmentSecrets orig_conv;
46750         orig_conv.inner = untag_ptr(orig);
46751         orig_conv.is_owned = ptr_is_owned(orig);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46753         orig_conv.is_owned = false;
46754         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
46755         uint64_t ret_ref = 0;
46756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46758         return ret_ref;
46759 }
46760
46761 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
46762         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
46763         uint64_t ret_ref = 0;
46764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46766         return ret_ref;
46767 }
46768
46769 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
46770         LDKCounterpartyCommitmentSecrets this_arg_conv;
46771         this_arg_conv.inner = untag_ptr(this_arg);
46772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46774         this_arg_conv.is_owned = false;
46775         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
46776         return ret_conv;
46777 }
46778
46779 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
46780         LDKCounterpartyCommitmentSecrets this_arg_conv;
46781         this_arg_conv.inner = untag_ptr(this_arg);
46782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46784         this_arg_conv.is_owned = false;
46785         LDKThirtyTwoBytes secret_ref;
46786         CHECK(secret->arr_len == 32);
46787         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
46788         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
46789         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
46790         return tag_ptr(ret_conv, true);
46791 }
46792
46793 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
46794         LDKCounterpartyCommitmentSecrets this_arg_conv;
46795         this_arg_conv.inner = untag_ptr(this_arg);
46796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46798         this_arg_conv.is_owned = false;
46799         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46800         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
46801         return ret_arr;
46802 }
46803
46804 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
46805         LDKCounterpartyCommitmentSecrets obj_conv;
46806         obj_conv.inner = untag_ptr(obj);
46807         obj_conv.is_owned = ptr_is_owned(obj);
46808         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46809         obj_conv.is_owned = false;
46810         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
46811         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46812         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46813         CVec_u8Z_free(ret_var);
46814         return ret_arr;
46815 }
46816
46817 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
46818         LDKu8slice ser_ref;
46819         ser_ref.datalen = ser->arr_len;
46820         ser_ref.data = ser->elems;
46821         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
46822         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
46823         FREE(ser);
46824         return tag_ptr(ret_conv, true);
46825 }
46826
46827 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
46828         LDKPublicKey per_commitment_point_ref;
46829         CHECK(per_commitment_point->arr_len == 33);
46830         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
46831         uint8_t base_secret_arr[32];
46832         CHECK(base_secret->arr_len == 32);
46833         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
46834         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
46835         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46836         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
46837         return ret_arr;
46838 }
46839
46840 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
46841         LDKPublicKey per_commitment_point_ref;
46842         CHECK(per_commitment_point->arr_len == 33);
46843         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
46844         LDKPublicKey base_point_ref;
46845         CHECK(base_point->arr_len == 33);
46846         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
46847         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46848         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
46849         return ret_arr;
46850 }
46851
46852 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) {
46853         uint8_t per_commitment_secret_arr[32];
46854         CHECK(per_commitment_secret->arr_len == 32);
46855         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
46856         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
46857         uint8_t countersignatory_revocation_base_secret_arr[32];
46858         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
46859         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
46860         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
46861         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46862         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
46863         return ret_arr;
46864 }
46865
46866 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) {
46867         LDKPublicKey per_commitment_point_ref;
46868         CHECK(per_commitment_point->arr_len == 33);
46869         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
46870         LDKPublicKey countersignatory_revocation_base_point_ref;
46871         CHECK(countersignatory_revocation_base_point->arr_len == 33);
46872         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
46873         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46874         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
46875         return ret_arr;
46876 }
46877
46878 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
46879         LDKTxCreationKeys this_obj_conv;
46880         this_obj_conv.inner = untag_ptr(this_obj);
46881         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46883         TxCreationKeys_free(this_obj_conv);
46884 }
46885
46886 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
46887         LDKTxCreationKeys this_ptr_conv;
46888         this_ptr_conv.inner = untag_ptr(this_ptr);
46889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46891         this_ptr_conv.is_owned = false;
46892         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46893         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46894         return ret_arr;
46895 }
46896
46897 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
46898         LDKTxCreationKeys this_ptr_conv;
46899         this_ptr_conv.inner = untag_ptr(this_ptr);
46900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46902         this_ptr_conv.is_owned = false;
46903         LDKPublicKey val_ref;
46904         CHECK(val->arr_len == 33);
46905         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46906         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
46907 }
46908
46909 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
46910         LDKTxCreationKeys this_ptr_conv;
46911         this_ptr_conv.inner = untag_ptr(this_ptr);
46912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46914         this_ptr_conv.is_owned = false;
46915         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46916         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
46917         return ret_arr;
46918 }
46919
46920 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
46921         LDKTxCreationKeys this_ptr_conv;
46922         this_ptr_conv.inner = untag_ptr(this_ptr);
46923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46925         this_ptr_conv.is_owned = false;
46926         LDKPublicKey val_ref;
46927         CHECK(val->arr_len == 33);
46928         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46929         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
46930 }
46931
46932 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
46933         LDKTxCreationKeys this_ptr_conv;
46934         this_ptr_conv.inner = untag_ptr(this_ptr);
46935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46937         this_ptr_conv.is_owned = false;
46938         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46939         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
46940         return ret_arr;
46941 }
46942
46943 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
46944         LDKTxCreationKeys this_ptr_conv;
46945         this_ptr_conv.inner = untag_ptr(this_ptr);
46946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46948         this_ptr_conv.is_owned = false;
46949         LDKPublicKey val_ref;
46950         CHECK(val->arr_len == 33);
46951         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46952         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
46953 }
46954
46955 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
46956         LDKTxCreationKeys this_ptr_conv;
46957         this_ptr_conv.inner = untag_ptr(this_ptr);
46958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46960         this_ptr_conv.is_owned = false;
46961         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46962         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
46963         return ret_arr;
46964 }
46965
46966 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
46967         LDKTxCreationKeys this_ptr_conv;
46968         this_ptr_conv.inner = untag_ptr(this_ptr);
46969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46971         this_ptr_conv.is_owned = false;
46972         LDKPublicKey val_ref;
46973         CHECK(val->arr_len == 33);
46974         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46975         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
46976 }
46977
46978 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
46979         LDKTxCreationKeys this_ptr_conv;
46980         this_ptr_conv.inner = untag_ptr(this_ptr);
46981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46983         this_ptr_conv.is_owned = false;
46984         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46985         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
46986         return ret_arr;
46987 }
46988
46989 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) {
46990         LDKTxCreationKeys this_ptr_conv;
46991         this_ptr_conv.inner = untag_ptr(this_ptr);
46992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46994         this_ptr_conv.is_owned = false;
46995         LDKPublicKey val_ref;
46996         CHECK(val->arr_len == 33);
46997         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46998         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
46999 }
47000
47001 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) {
47002         LDKPublicKey per_commitment_point_arg_ref;
47003         CHECK(per_commitment_point_arg->arr_len == 33);
47004         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
47005         LDKPublicKey revocation_key_arg_ref;
47006         CHECK(revocation_key_arg->arr_len == 33);
47007         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
47008         LDKPublicKey broadcaster_htlc_key_arg_ref;
47009         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
47010         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
47011         LDKPublicKey countersignatory_htlc_key_arg_ref;
47012         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
47013         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
47014         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
47015         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
47016         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
47017         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);
47018         uint64_t ret_ref = 0;
47019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47021         return ret_ref;
47022 }
47023
47024 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
47025         LDKTxCreationKeys a_conv;
47026         a_conv.inner = untag_ptr(a);
47027         a_conv.is_owned = ptr_is_owned(a);
47028         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47029         a_conv.is_owned = false;
47030         LDKTxCreationKeys b_conv;
47031         b_conv.inner = untag_ptr(b);
47032         b_conv.is_owned = ptr_is_owned(b);
47033         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47034         b_conv.is_owned = false;
47035         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
47036         return ret_conv;
47037 }
47038
47039 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
47040         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
47041         uint64_t ret_ref = 0;
47042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47044         return ret_ref;
47045 }
47046 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
47047         LDKTxCreationKeys arg_conv;
47048         arg_conv.inner = untag_ptr(arg);
47049         arg_conv.is_owned = ptr_is_owned(arg);
47050         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47051         arg_conv.is_owned = false;
47052         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
47053         return ret_conv;
47054 }
47055
47056 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
47057         LDKTxCreationKeys orig_conv;
47058         orig_conv.inner = untag_ptr(orig);
47059         orig_conv.is_owned = ptr_is_owned(orig);
47060         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47061         orig_conv.is_owned = false;
47062         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
47063         uint64_t ret_ref = 0;
47064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47066         return ret_ref;
47067 }
47068
47069 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
47070         LDKTxCreationKeys obj_conv;
47071         obj_conv.inner = untag_ptr(obj);
47072         obj_conv.is_owned = ptr_is_owned(obj);
47073         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47074         obj_conv.is_owned = false;
47075         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
47076         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47077         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47078         CVec_u8Z_free(ret_var);
47079         return ret_arr;
47080 }
47081
47082 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
47083         LDKu8slice ser_ref;
47084         ser_ref.datalen = ser->arr_len;
47085         ser_ref.data = ser->elems;
47086         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
47087         *ret_conv = TxCreationKeys_read(ser_ref);
47088         FREE(ser);
47089         return tag_ptr(ret_conv, true);
47090 }
47091
47092 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
47093         LDKChannelPublicKeys this_obj_conv;
47094         this_obj_conv.inner = untag_ptr(this_obj);
47095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47097         ChannelPublicKeys_free(this_obj_conv);
47098 }
47099
47100 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
47101         LDKChannelPublicKeys this_ptr_conv;
47102         this_ptr_conv.inner = untag_ptr(this_ptr);
47103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47105         this_ptr_conv.is_owned = false;
47106         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47107         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47108         return ret_arr;
47109 }
47110
47111 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47112         LDKChannelPublicKeys this_ptr_conv;
47113         this_ptr_conv.inner = untag_ptr(this_ptr);
47114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47116         this_ptr_conv.is_owned = false;
47117         LDKPublicKey val_ref;
47118         CHECK(val->arr_len == 33);
47119         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47120         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
47121 }
47122
47123 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
47124         LDKChannelPublicKeys this_ptr_conv;
47125         this_ptr_conv.inner = untag_ptr(this_ptr);
47126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47128         this_ptr_conv.is_owned = false;
47129         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47130         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
47131         return ret_arr;
47132 }
47133
47134 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
47135         LDKChannelPublicKeys this_ptr_conv;
47136         this_ptr_conv.inner = untag_ptr(this_ptr);
47137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47139         this_ptr_conv.is_owned = false;
47140         LDKPublicKey val_ref;
47141         CHECK(val->arr_len == 33);
47142         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47143         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
47144 }
47145
47146 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
47147         LDKChannelPublicKeys this_ptr_conv;
47148         this_ptr_conv.inner = untag_ptr(this_ptr);
47149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47151         this_ptr_conv.is_owned = false;
47152         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47153         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
47154         return ret_arr;
47155 }
47156
47157 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
47158         LDKChannelPublicKeys this_ptr_conv;
47159         this_ptr_conv.inner = untag_ptr(this_ptr);
47160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47162         this_ptr_conv.is_owned = false;
47163         LDKPublicKey val_ref;
47164         CHECK(val->arr_len == 33);
47165         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47166         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
47167 }
47168
47169 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
47170         LDKChannelPublicKeys this_ptr_conv;
47171         this_ptr_conv.inner = untag_ptr(this_ptr);
47172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47174         this_ptr_conv.is_owned = false;
47175         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47176         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47177         return ret_arr;
47178 }
47179
47180 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
47181         LDKChannelPublicKeys this_ptr_conv;
47182         this_ptr_conv.inner = untag_ptr(this_ptr);
47183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47185         this_ptr_conv.is_owned = false;
47186         LDKPublicKey val_ref;
47187         CHECK(val->arr_len == 33);
47188         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47189         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47190 }
47191
47192 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
47193         LDKChannelPublicKeys this_ptr_conv;
47194         this_ptr_conv.inner = untag_ptr(this_ptr);
47195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47197         this_ptr_conv.is_owned = false;
47198         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47199         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
47200         return ret_arr;
47201 }
47202
47203 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
47204         LDKChannelPublicKeys this_ptr_conv;
47205         this_ptr_conv.inner = untag_ptr(this_ptr);
47206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47208         this_ptr_conv.is_owned = false;
47209         LDKPublicKey val_ref;
47210         CHECK(val->arr_len == 33);
47211         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47212         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
47213 }
47214
47215 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) {
47216         LDKPublicKey funding_pubkey_arg_ref;
47217         CHECK(funding_pubkey_arg->arr_len == 33);
47218         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47219         LDKPublicKey revocation_basepoint_arg_ref;
47220         CHECK(revocation_basepoint_arg->arr_len == 33);
47221         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
47222         LDKPublicKey payment_point_arg_ref;
47223         CHECK(payment_point_arg->arr_len == 33);
47224         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
47225         LDKPublicKey delayed_payment_basepoint_arg_ref;
47226         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
47227         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
47228         LDKPublicKey htlc_basepoint_arg_ref;
47229         CHECK(htlc_basepoint_arg->arr_len == 33);
47230         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
47231         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);
47232         uint64_t ret_ref = 0;
47233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47235         return ret_ref;
47236 }
47237
47238 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
47239         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
47240         uint64_t ret_ref = 0;
47241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47243         return ret_ref;
47244 }
47245 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
47246         LDKChannelPublicKeys arg_conv;
47247         arg_conv.inner = untag_ptr(arg);
47248         arg_conv.is_owned = ptr_is_owned(arg);
47249         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47250         arg_conv.is_owned = false;
47251         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
47252         return ret_conv;
47253 }
47254
47255 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
47256         LDKChannelPublicKeys orig_conv;
47257         orig_conv.inner = untag_ptr(orig);
47258         orig_conv.is_owned = ptr_is_owned(orig);
47259         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47260         orig_conv.is_owned = false;
47261         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
47262         uint64_t ret_ref = 0;
47263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47265         return ret_ref;
47266 }
47267
47268 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
47269         LDKChannelPublicKeys o_conv;
47270         o_conv.inner = untag_ptr(o);
47271         o_conv.is_owned = ptr_is_owned(o);
47272         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47273         o_conv.is_owned = false;
47274         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
47275         return ret_conv;
47276 }
47277
47278 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
47279         LDKChannelPublicKeys a_conv;
47280         a_conv.inner = untag_ptr(a);
47281         a_conv.is_owned = ptr_is_owned(a);
47282         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47283         a_conv.is_owned = false;
47284         LDKChannelPublicKeys b_conv;
47285         b_conv.inner = untag_ptr(b);
47286         b_conv.is_owned = ptr_is_owned(b);
47287         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47288         b_conv.is_owned = false;
47289         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
47290         return ret_conv;
47291 }
47292
47293 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
47294         LDKChannelPublicKeys obj_conv;
47295         obj_conv.inner = untag_ptr(obj);
47296         obj_conv.is_owned = ptr_is_owned(obj);
47297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47298         obj_conv.is_owned = false;
47299         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
47300         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47301         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47302         CVec_u8Z_free(ret_var);
47303         return ret_arr;
47304 }
47305
47306 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
47307         LDKu8slice ser_ref;
47308         ser_ref.datalen = ser->arr_len;
47309         ser_ref.data = ser->elems;
47310         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
47311         *ret_conv = ChannelPublicKeys_read(ser_ref);
47312         FREE(ser);
47313         return tag_ptr(ret_conv, true);
47314 }
47315
47316 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) {
47317         LDKPublicKey per_commitment_point_ref;
47318         CHECK(per_commitment_point->arr_len == 33);
47319         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47320         LDKPublicKey broadcaster_delayed_payment_base_ref;
47321         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
47322         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
47323         LDKPublicKey broadcaster_htlc_base_ref;
47324         CHECK(broadcaster_htlc_base->arr_len == 33);
47325         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
47326         LDKPublicKey countersignatory_revocation_base_ref;
47327         CHECK(countersignatory_revocation_base->arr_len == 33);
47328         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
47329         LDKPublicKey countersignatory_htlc_base_ref;
47330         CHECK(countersignatory_htlc_base->arr_len == 33);
47331         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
47332         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);
47333         uint64_t ret_ref = 0;
47334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47336         return ret_ref;
47337 }
47338
47339 uint64_t  __attribute__((export_name("TS_TxCreationKeys_from_channel_static_keys"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint64_t broadcaster_keys, uint64_t countersignatory_keys) {
47340         LDKPublicKey per_commitment_point_ref;
47341         CHECK(per_commitment_point->arr_len == 33);
47342         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47343         LDKChannelPublicKeys broadcaster_keys_conv;
47344         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
47345         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
47346         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
47347         broadcaster_keys_conv.is_owned = false;
47348         LDKChannelPublicKeys countersignatory_keys_conv;
47349         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
47350         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
47351         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
47352         countersignatory_keys_conv.is_owned = false;
47353         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
47354         uint64_t ret_ref = 0;
47355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47357         return ret_ref;
47358 }
47359
47360 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) {
47361         LDKPublicKey revocation_key_ref;
47362         CHECK(revocation_key->arr_len == 33);
47363         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
47364         LDKPublicKey broadcaster_delayed_payment_key_ref;
47365         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
47366         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
47367         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
47368         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47369         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47370         CVec_u8Z_free(ret_var);
47371         return ret_arr;
47372 }
47373
47374 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
47375         LDKChannelTypeFeatures channel_type_features_conv;
47376         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47377         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47378         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47379         channel_type_features_conv.is_owned = false;
47380         LDKPublicKey payment_key_ref;
47381         CHECK(payment_key->arr_len == 33);
47382         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
47383         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
47384         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47385         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47386         CVec_u8Z_free(ret_var);
47387         return ret_arr;
47388 }
47389
47390 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
47391         LDKHTLCOutputInCommitment this_obj_conv;
47392         this_obj_conv.inner = untag_ptr(this_obj);
47393         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47395         HTLCOutputInCommitment_free(this_obj_conv);
47396 }
47397
47398 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
47399         LDKHTLCOutputInCommitment this_ptr_conv;
47400         this_ptr_conv.inner = untag_ptr(this_ptr);
47401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47403         this_ptr_conv.is_owned = false;
47404         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
47405         return ret_conv;
47406 }
47407
47408 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
47409         LDKHTLCOutputInCommitment this_ptr_conv;
47410         this_ptr_conv.inner = untag_ptr(this_ptr);
47411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47413         this_ptr_conv.is_owned = false;
47414         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
47415 }
47416
47417 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
47418         LDKHTLCOutputInCommitment this_ptr_conv;
47419         this_ptr_conv.inner = untag_ptr(this_ptr);
47420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47422         this_ptr_conv.is_owned = false;
47423         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
47424         return ret_conv;
47425 }
47426
47427 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
47428         LDKHTLCOutputInCommitment this_ptr_conv;
47429         this_ptr_conv.inner = untag_ptr(this_ptr);
47430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47432         this_ptr_conv.is_owned = false;
47433         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
47434 }
47435
47436 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
47437         LDKHTLCOutputInCommitment this_ptr_conv;
47438         this_ptr_conv.inner = untag_ptr(this_ptr);
47439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47441         this_ptr_conv.is_owned = false;
47442         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
47443         return ret_conv;
47444 }
47445
47446 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
47447         LDKHTLCOutputInCommitment this_ptr_conv;
47448         this_ptr_conv.inner = untag_ptr(this_ptr);
47449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47451         this_ptr_conv.is_owned = false;
47452         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
47453 }
47454
47455 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
47456         LDKHTLCOutputInCommitment this_ptr_conv;
47457         this_ptr_conv.inner = untag_ptr(this_ptr);
47458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47460         this_ptr_conv.is_owned = false;
47461         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47462         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
47463         return ret_arr;
47464 }
47465
47466 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
47467         LDKHTLCOutputInCommitment this_ptr_conv;
47468         this_ptr_conv.inner = untag_ptr(this_ptr);
47469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47471         this_ptr_conv.is_owned = false;
47472         LDKThirtyTwoBytes val_ref;
47473         CHECK(val->arr_len == 32);
47474         memcpy(val_ref.data, val->elems, 32); FREE(val);
47475         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
47476 }
47477
47478 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
47479         LDKHTLCOutputInCommitment this_ptr_conv;
47480         this_ptr_conv.inner = untag_ptr(this_ptr);
47481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47483         this_ptr_conv.is_owned = false;
47484         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
47485         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
47486         uint64_t ret_ref = tag_ptr(ret_copy, true);
47487         return ret_ref;
47488 }
47489
47490 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
47491         LDKHTLCOutputInCommitment this_ptr_conv;
47492         this_ptr_conv.inner = untag_ptr(this_ptr);
47493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47495         this_ptr_conv.is_owned = false;
47496         void* val_ptr = untag_ptr(val);
47497         CHECK_ACCESS(val_ptr);
47498         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
47499         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
47500         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
47501 }
47502
47503 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) {
47504         LDKThirtyTwoBytes payment_hash_arg_ref;
47505         CHECK(payment_hash_arg->arr_len == 32);
47506         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
47507         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
47508         CHECK_ACCESS(transaction_output_index_arg_ptr);
47509         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
47510         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
47511         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
47512         uint64_t ret_ref = 0;
47513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47515         return ret_ref;
47516 }
47517
47518 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
47519         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
47520         uint64_t ret_ref = 0;
47521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47523         return ret_ref;
47524 }
47525 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
47526         LDKHTLCOutputInCommitment arg_conv;
47527         arg_conv.inner = untag_ptr(arg);
47528         arg_conv.is_owned = ptr_is_owned(arg);
47529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47530         arg_conv.is_owned = false;
47531         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
47532         return ret_conv;
47533 }
47534
47535 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
47536         LDKHTLCOutputInCommitment orig_conv;
47537         orig_conv.inner = untag_ptr(orig);
47538         orig_conv.is_owned = ptr_is_owned(orig);
47539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47540         orig_conv.is_owned = false;
47541         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
47542         uint64_t ret_ref = 0;
47543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47545         return ret_ref;
47546 }
47547
47548 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
47549         LDKHTLCOutputInCommitment a_conv;
47550         a_conv.inner = untag_ptr(a);
47551         a_conv.is_owned = ptr_is_owned(a);
47552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47553         a_conv.is_owned = false;
47554         LDKHTLCOutputInCommitment b_conv;
47555         b_conv.inner = untag_ptr(b);
47556         b_conv.is_owned = ptr_is_owned(b);
47557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47558         b_conv.is_owned = false;
47559         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
47560         return ret_conv;
47561 }
47562
47563 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
47564         LDKHTLCOutputInCommitment obj_conv;
47565         obj_conv.inner = untag_ptr(obj);
47566         obj_conv.is_owned = ptr_is_owned(obj);
47567         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47568         obj_conv.is_owned = false;
47569         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
47570         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47571         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47572         CVec_u8Z_free(ret_var);
47573         return ret_arr;
47574 }
47575
47576 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
47577         LDKu8slice ser_ref;
47578         ser_ref.datalen = ser->arr_len;
47579         ser_ref.data = ser->elems;
47580         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
47581         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
47582         FREE(ser);
47583         return tag_ptr(ret_conv, true);
47584 }
47585
47586 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
47587         LDKHTLCOutputInCommitment htlc_conv;
47588         htlc_conv.inner = untag_ptr(htlc);
47589         htlc_conv.is_owned = ptr_is_owned(htlc);
47590         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
47591         htlc_conv.is_owned = false;
47592         LDKChannelTypeFeatures channel_type_features_conv;
47593         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47594         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47595         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47596         channel_type_features_conv.is_owned = false;
47597         LDKTxCreationKeys keys_conv;
47598         keys_conv.inner = untag_ptr(keys);
47599         keys_conv.is_owned = ptr_is_owned(keys);
47600         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
47601         keys_conv.is_owned = false;
47602         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
47603         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47604         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47605         CVec_u8Z_free(ret_var);
47606         return ret_arr;
47607 }
47608
47609 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
47610         LDKPublicKey broadcaster_ref;
47611         CHECK(broadcaster->arr_len == 33);
47612         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
47613         LDKPublicKey countersignatory_ref;
47614         CHECK(countersignatory->arr_len == 33);
47615         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
47616         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
47617         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47618         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47619         CVec_u8Z_free(ret_var);
47620         return ret_arr;
47621 }
47622
47623 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) {
47624         uint8_t commitment_txid_arr[32];
47625         CHECK(commitment_txid->arr_len == 32);
47626         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
47627         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
47628         LDKHTLCOutputInCommitment htlc_conv;
47629         htlc_conv.inner = untag_ptr(htlc);
47630         htlc_conv.is_owned = ptr_is_owned(htlc);
47631         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
47632         htlc_conv.is_owned = false;
47633         LDKChannelTypeFeatures channel_type_features_conv;
47634         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47635         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47636         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47637         channel_type_features_conv.is_owned = false;
47638         LDKPublicKey broadcaster_delayed_payment_key_ref;
47639         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
47640         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
47641         LDKPublicKey revocation_key_ref;
47642         CHECK(revocation_key->arr_len == 33);
47643         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
47644         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);
47645         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47646         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47647         Transaction_free(ret_var);
47648         return ret_arr;
47649 }
47650
47651 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) {
47652         LDKECDSASignature local_sig_ref;
47653         CHECK(local_sig->arr_len == 64);
47654         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
47655         LDKECDSASignature remote_sig_ref;
47656         CHECK(remote_sig->arr_len == 64);
47657         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
47658         void* preimage_ptr = untag_ptr(preimage);
47659         CHECK_ACCESS(preimage_ptr);
47660         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
47661         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
47662         LDKu8slice redeem_script_ref;
47663         redeem_script_ref.datalen = redeem_script->arr_len;
47664         redeem_script_ref.data = redeem_script->elems;
47665         LDKChannelTypeFeatures channel_type_features_conv;
47666         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47667         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47668         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47669         channel_type_features_conv.is_owned = false;
47670         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
47671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47673         Witness_free(ret_var);
47674         FREE(redeem_script);
47675         return ret_arr;
47676 }
47677
47678 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
47679         LDKPublicKey payment_point_ref;
47680         CHECK(payment_point->arr_len == 33);
47681         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
47682         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
47683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47685         CVec_u8Z_free(ret_var);
47686         return ret_arr;
47687 }
47688
47689 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
47690         LDKPublicKey funding_pubkey_ref;
47691         CHECK(funding_pubkey->arr_len == 33);
47692         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
47693         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
47694         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47695         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47696         CVec_u8Z_free(ret_var);
47697         return ret_arr;
47698 }
47699
47700 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
47701         LDKPublicKey funding_key_ref;
47702         CHECK(funding_key->arr_len == 33);
47703         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
47704         LDKECDSASignature funding_sig_ref;
47705         CHECK(funding_sig->arr_len == 64);
47706         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
47707         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
47708         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47709         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47710         Witness_free(ret_var);
47711         return ret_arr;
47712 }
47713
47714 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
47715         LDKChannelTransactionParameters this_obj_conv;
47716         this_obj_conv.inner = untag_ptr(this_obj);
47717         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47719         ChannelTransactionParameters_free(this_obj_conv);
47720 }
47721
47722 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
47723         LDKChannelTransactionParameters this_ptr_conv;
47724         this_ptr_conv.inner = untag_ptr(this_ptr);
47725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47727         this_ptr_conv.is_owned = false;
47728         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
47729         uint64_t ret_ref = 0;
47730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47732         return ret_ref;
47733 }
47734
47735 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
47736         LDKChannelTransactionParameters this_ptr_conv;
47737         this_ptr_conv.inner = untag_ptr(this_ptr);
47738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47740         this_ptr_conv.is_owned = false;
47741         LDKChannelPublicKeys val_conv;
47742         val_conv.inner = untag_ptr(val);
47743         val_conv.is_owned = ptr_is_owned(val);
47744         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47745         val_conv = ChannelPublicKeys_clone(&val_conv);
47746         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
47747 }
47748
47749 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
47750         LDKChannelTransactionParameters this_ptr_conv;
47751         this_ptr_conv.inner = untag_ptr(this_ptr);
47752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47754         this_ptr_conv.is_owned = false;
47755         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
47756         return ret_conv;
47757 }
47758
47759 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) {
47760         LDKChannelTransactionParameters this_ptr_conv;
47761         this_ptr_conv.inner = untag_ptr(this_ptr);
47762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47764         this_ptr_conv.is_owned = false;
47765         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
47766 }
47767
47768 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
47769         LDKChannelTransactionParameters this_ptr_conv;
47770         this_ptr_conv.inner = untag_ptr(this_ptr);
47771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47773         this_ptr_conv.is_owned = false;
47774         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
47775         return ret_conv;
47776 }
47777
47778 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
47779         LDKChannelTransactionParameters this_ptr_conv;
47780         this_ptr_conv.inner = untag_ptr(this_ptr);
47781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47783         this_ptr_conv.is_owned = false;
47784         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
47785 }
47786
47787 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
47788         LDKChannelTransactionParameters this_ptr_conv;
47789         this_ptr_conv.inner = untag_ptr(this_ptr);
47790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47792         this_ptr_conv.is_owned = false;
47793         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
47794         uint64_t ret_ref = 0;
47795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47797         return ret_ref;
47798 }
47799
47800 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
47801         LDKChannelTransactionParameters this_ptr_conv;
47802         this_ptr_conv.inner = untag_ptr(this_ptr);
47803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47805         this_ptr_conv.is_owned = false;
47806         LDKCounterpartyChannelTransactionParameters val_conv;
47807         val_conv.inner = untag_ptr(val);
47808         val_conv.is_owned = ptr_is_owned(val);
47809         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47810         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
47811         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
47812 }
47813
47814 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
47815         LDKChannelTransactionParameters this_ptr_conv;
47816         this_ptr_conv.inner = untag_ptr(this_ptr);
47817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47819         this_ptr_conv.is_owned = false;
47820         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
47821         uint64_t ret_ref = 0;
47822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47824         return ret_ref;
47825 }
47826
47827 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
47828         LDKChannelTransactionParameters this_ptr_conv;
47829         this_ptr_conv.inner = untag_ptr(this_ptr);
47830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47832         this_ptr_conv.is_owned = false;
47833         LDKOutPoint val_conv;
47834         val_conv.inner = untag_ptr(val);
47835         val_conv.is_owned = ptr_is_owned(val);
47836         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47837         val_conv = OutPoint_clone(&val_conv);
47838         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
47839 }
47840
47841 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
47842         LDKChannelTransactionParameters this_ptr_conv;
47843         this_ptr_conv.inner = untag_ptr(this_ptr);
47844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47846         this_ptr_conv.is_owned = false;
47847         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
47848         uint64_t ret_ref = 0;
47849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47851         return ret_ref;
47852 }
47853
47854 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
47855         LDKChannelTransactionParameters this_ptr_conv;
47856         this_ptr_conv.inner = untag_ptr(this_ptr);
47857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47859         this_ptr_conv.is_owned = false;
47860         LDKChannelTypeFeatures val_conv;
47861         val_conv.inner = untag_ptr(val);
47862         val_conv.is_owned = ptr_is_owned(val);
47863         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47864         val_conv = ChannelTypeFeatures_clone(&val_conv);
47865         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
47866 }
47867
47868 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) {
47869         LDKChannelPublicKeys holder_pubkeys_arg_conv;
47870         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
47871         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
47872         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
47873         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
47874         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
47875         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
47876         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
47877         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
47878         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
47879         LDKOutPoint funding_outpoint_arg_conv;
47880         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
47881         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
47882         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
47883         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
47884         LDKChannelTypeFeatures channel_type_features_arg_conv;
47885         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
47886         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
47887         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
47888         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
47889         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);
47890         uint64_t ret_ref = 0;
47891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47893         return ret_ref;
47894 }
47895
47896 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
47897         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
47898         uint64_t ret_ref = 0;
47899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47901         return ret_ref;
47902 }
47903 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
47904         LDKChannelTransactionParameters arg_conv;
47905         arg_conv.inner = untag_ptr(arg);
47906         arg_conv.is_owned = ptr_is_owned(arg);
47907         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47908         arg_conv.is_owned = false;
47909         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
47910         return ret_conv;
47911 }
47912
47913 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
47914         LDKChannelTransactionParameters orig_conv;
47915         orig_conv.inner = untag_ptr(orig);
47916         orig_conv.is_owned = ptr_is_owned(orig);
47917         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47918         orig_conv.is_owned = false;
47919         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
47920         uint64_t ret_ref = 0;
47921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47923         return ret_ref;
47924 }
47925
47926 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
47927         LDKChannelTransactionParameters o_conv;
47928         o_conv.inner = untag_ptr(o);
47929         o_conv.is_owned = ptr_is_owned(o);
47930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47931         o_conv.is_owned = false;
47932         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
47933         return ret_conv;
47934 }
47935
47936 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
47937         LDKChannelTransactionParameters a_conv;
47938         a_conv.inner = untag_ptr(a);
47939         a_conv.is_owned = ptr_is_owned(a);
47940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47941         a_conv.is_owned = false;
47942         LDKChannelTransactionParameters b_conv;
47943         b_conv.inner = untag_ptr(b);
47944         b_conv.is_owned = ptr_is_owned(b);
47945         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47946         b_conv.is_owned = false;
47947         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
47948         return ret_conv;
47949 }
47950
47951 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
47952         LDKCounterpartyChannelTransactionParameters this_obj_conv;
47953         this_obj_conv.inner = untag_ptr(this_obj);
47954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47956         CounterpartyChannelTransactionParameters_free(this_obj_conv);
47957 }
47958
47959 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
47960         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
47961         this_ptr_conv.inner = untag_ptr(this_ptr);
47962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47964         this_ptr_conv.is_owned = false;
47965         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
47966         uint64_t ret_ref = 0;
47967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47969         return ret_ref;
47970 }
47971
47972 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
47973         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
47974         this_ptr_conv.inner = untag_ptr(this_ptr);
47975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47977         this_ptr_conv.is_owned = false;
47978         LDKChannelPublicKeys val_conv;
47979         val_conv.inner = untag_ptr(val);
47980         val_conv.is_owned = ptr_is_owned(val);
47981         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47982         val_conv = ChannelPublicKeys_clone(&val_conv);
47983         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
47984 }
47985
47986 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
47987         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
47988         this_ptr_conv.inner = untag_ptr(this_ptr);
47989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47991         this_ptr_conv.is_owned = false;
47992         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
47993         return ret_conv;
47994 }
47995
47996 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
47997         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
47998         this_ptr_conv.inner = untag_ptr(this_ptr);
47999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48001         this_ptr_conv.is_owned = false;
48002         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
48003 }
48004
48005 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
48006         LDKChannelPublicKeys pubkeys_arg_conv;
48007         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
48008         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
48009         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
48010         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
48011         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
48012         uint64_t ret_ref = 0;
48013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48015         return ret_ref;
48016 }
48017
48018 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
48019         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
48020         uint64_t ret_ref = 0;
48021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48023         return ret_ref;
48024 }
48025 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
48026         LDKCounterpartyChannelTransactionParameters arg_conv;
48027         arg_conv.inner = untag_ptr(arg);
48028         arg_conv.is_owned = ptr_is_owned(arg);
48029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48030         arg_conv.is_owned = false;
48031         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
48032         return ret_conv;
48033 }
48034
48035 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
48036         LDKCounterpartyChannelTransactionParameters orig_conv;
48037         orig_conv.inner = untag_ptr(orig);
48038         orig_conv.is_owned = ptr_is_owned(orig);
48039         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48040         orig_conv.is_owned = false;
48041         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
48042         uint64_t ret_ref = 0;
48043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48045         return ret_ref;
48046 }
48047
48048 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
48049         LDKCounterpartyChannelTransactionParameters o_conv;
48050         o_conv.inner = untag_ptr(o);
48051         o_conv.is_owned = ptr_is_owned(o);
48052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48053         o_conv.is_owned = false;
48054         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
48055         return ret_conv;
48056 }
48057
48058 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
48059         LDKCounterpartyChannelTransactionParameters a_conv;
48060         a_conv.inner = untag_ptr(a);
48061         a_conv.is_owned = ptr_is_owned(a);
48062         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48063         a_conv.is_owned = false;
48064         LDKCounterpartyChannelTransactionParameters b_conv;
48065         b_conv.inner = untag_ptr(b);
48066         b_conv.is_owned = ptr_is_owned(b);
48067         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48068         b_conv.is_owned = false;
48069         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
48070         return ret_conv;
48071 }
48072
48073 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
48074         LDKChannelTransactionParameters this_arg_conv;
48075         this_arg_conv.inner = untag_ptr(this_arg);
48076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48078         this_arg_conv.is_owned = false;
48079         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
48080         return ret_conv;
48081 }
48082
48083 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
48084         LDKChannelTransactionParameters this_arg_conv;
48085         this_arg_conv.inner = untag_ptr(this_arg);
48086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48088         this_arg_conv.is_owned = false;
48089         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
48090         uint64_t ret_ref = 0;
48091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48093         return ret_ref;
48094 }
48095
48096 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
48097         LDKChannelTransactionParameters this_arg_conv;
48098         this_arg_conv.inner = untag_ptr(this_arg);
48099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48101         this_arg_conv.is_owned = false;
48102         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
48103         uint64_t ret_ref = 0;
48104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48106         return ret_ref;
48107 }
48108
48109 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
48110         LDKCounterpartyChannelTransactionParameters obj_conv;
48111         obj_conv.inner = untag_ptr(obj);
48112         obj_conv.is_owned = ptr_is_owned(obj);
48113         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48114         obj_conv.is_owned = false;
48115         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
48116         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48117         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48118         CVec_u8Z_free(ret_var);
48119         return ret_arr;
48120 }
48121
48122 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
48123         LDKu8slice ser_ref;
48124         ser_ref.datalen = ser->arr_len;
48125         ser_ref.data = ser->elems;
48126         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
48127         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
48128         FREE(ser);
48129         return tag_ptr(ret_conv, true);
48130 }
48131
48132 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
48133         LDKChannelTransactionParameters obj_conv;
48134         obj_conv.inner = untag_ptr(obj);
48135         obj_conv.is_owned = ptr_is_owned(obj);
48136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48137         obj_conv.is_owned = false;
48138         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
48139         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48140         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48141         CVec_u8Z_free(ret_var);
48142         return ret_arr;
48143 }
48144
48145 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
48146         LDKu8slice ser_ref;
48147         ser_ref.datalen = ser->arr_len;
48148         ser_ref.data = ser->elems;
48149         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
48150         *ret_conv = ChannelTransactionParameters_read(ser_ref);
48151         FREE(ser);
48152         return tag_ptr(ret_conv, true);
48153 }
48154
48155 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
48156         LDKDirectedChannelTransactionParameters this_obj_conv;
48157         this_obj_conv.inner = untag_ptr(this_obj);
48158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48160         DirectedChannelTransactionParameters_free(this_obj_conv);
48161 }
48162
48163 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
48164         LDKDirectedChannelTransactionParameters this_arg_conv;
48165         this_arg_conv.inner = untag_ptr(this_arg);
48166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48168         this_arg_conv.is_owned = false;
48169         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
48170         uint64_t ret_ref = 0;
48171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48173         return ret_ref;
48174 }
48175
48176 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
48177         LDKDirectedChannelTransactionParameters this_arg_conv;
48178         this_arg_conv.inner = untag_ptr(this_arg);
48179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48181         this_arg_conv.is_owned = false;
48182         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
48183         uint64_t ret_ref = 0;
48184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48186         return ret_ref;
48187 }
48188
48189 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
48190         LDKDirectedChannelTransactionParameters this_arg_conv;
48191         this_arg_conv.inner = untag_ptr(this_arg);
48192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48194         this_arg_conv.is_owned = false;
48195         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
48196         return ret_conv;
48197 }
48198
48199 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
48200         LDKDirectedChannelTransactionParameters this_arg_conv;
48201         this_arg_conv.inner = untag_ptr(this_arg);
48202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48204         this_arg_conv.is_owned = false;
48205         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
48206         return ret_conv;
48207 }
48208
48209 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
48210         LDKDirectedChannelTransactionParameters this_arg_conv;
48211         this_arg_conv.inner = untag_ptr(this_arg);
48212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48214         this_arg_conv.is_owned = false;
48215         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
48216         uint64_t ret_ref = 0;
48217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48219         return ret_ref;
48220 }
48221
48222 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
48223         LDKDirectedChannelTransactionParameters 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         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
48229         uint64_t ret_ref = 0;
48230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48232         return ret_ref;
48233 }
48234
48235 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
48236         LDKHolderCommitmentTransaction this_obj_conv;
48237         this_obj_conv.inner = untag_ptr(this_obj);
48238         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48240         HolderCommitmentTransaction_free(this_obj_conv);
48241 }
48242
48243 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
48244         LDKHolderCommitmentTransaction this_ptr_conv;
48245         this_ptr_conv.inner = untag_ptr(this_ptr);
48246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48248         this_ptr_conv.is_owned = false;
48249         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48250         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
48251         return ret_arr;
48252 }
48253
48254 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
48255         LDKHolderCommitmentTransaction this_ptr_conv;
48256         this_ptr_conv.inner = untag_ptr(this_ptr);
48257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48259         this_ptr_conv.is_owned = false;
48260         LDKECDSASignature val_ref;
48261         CHECK(val->arr_len == 64);
48262         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48263         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
48264 }
48265
48266 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
48267         LDKHolderCommitmentTransaction this_ptr_conv;
48268         this_ptr_conv.inner = untag_ptr(this_ptr);
48269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48271         this_ptr_conv.is_owned = false;
48272         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
48273         ptrArray ret_arr = NULL;
48274         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
48275         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
48276         for (size_t m = 0; m < ret_var.datalen; m++) {
48277                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
48278                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
48279                 ret_arr_ptr[m] = ret_conv_12_arr;
48280         }
48281         
48282         FREE(ret_var.data);
48283         return ret_arr;
48284 }
48285
48286 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
48287         LDKHolderCommitmentTransaction this_ptr_conv;
48288         this_ptr_conv.inner = untag_ptr(this_ptr);
48289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48291         this_ptr_conv.is_owned = false;
48292         LDKCVec_ECDSASignatureZ val_constr;
48293         val_constr.datalen = val->arr_len;
48294         if (val_constr.datalen > 0)
48295                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
48296         else
48297                 val_constr.data = NULL;
48298         int8_tArray* val_vals = (void*) val->elems;
48299         for (size_t m = 0; m < val_constr.datalen; m++) {
48300                 int8_tArray val_conv_12 = val_vals[m];
48301                 LDKECDSASignature val_conv_12_ref;
48302                 CHECK(val_conv_12->arr_len == 64);
48303                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
48304                 val_constr.data[m] = val_conv_12_ref;
48305         }
48306         FREE(val);
48307         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
48308 }
48309
48310 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
48311         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
48312         uint64_t ret_ref = 0;
48313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48315         return ret_ref;
48316 }
48317 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
48318         LDKHolderCommitmentTransaction arg_conv;
48319         arg_conv.inner = untag_ptr(arg);
48320         arg_conv.is_owned = ptr_is_owned(arg);
48321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48322         arg_conv.is_owned = false;
48323         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
48324         return ret_conv;
48325 }
48326
48327 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
48328         LDKHolderCommitmentTransaction orig_conv;
48329         orig_conv.inner = untag_ptr(orig);
48330         orig_conv.is_owned = ptr_is_owned(orig);
48331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48332         orig_conv.is_owned = false;
48333         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
48334         uint64_t ret_ref = 0;
48335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48337         return ret_ref;
48338 }
48339
48340 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
48341         LDKHolderCommitmentTransaction obj_conv;
48342         obj_conv.inner = untag_ptr(obj);
48343         obj_conv.is_owned = ptr_is_owned(obj);
48344         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48345         obj_conv.is_owned = false;
48346         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
48347         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48348         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48349         CVec_u8Z_free(ret_var);
48350         return ret_arr;
48351 }
48352
48353 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
48354         LDKu8slice ser_ref;
48355         ser_ref.datalen = ser->arr_len;
48356         ser_ref.data = ser->elems;
48357         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
48358         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
48359         FREE(ser);
48360         return tag_ptr(ret_conv, true);
48361 }
48362
48363 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) {
48364         LDKCommitmentTransaction commitment_tx_conv;
48365         commitment_tx_conv.inner = untag_ptr(commitment_tx);
48366         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
48367         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
48368         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
48369         LDKECDSASignature counterparty_sig_ref;
48370         CHECK(counterparty_sig->arr_len == 64);
48371         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
48372         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
48373         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
48374         if (counterparty_htlc_sigs_constr.datalen > 0)
48375                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
48376         else
48377                 counterparty_htlc_sigs_constr.data = NULL;
48378         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
48379         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
48380                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
48381                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
48382                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
48383                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
48384                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
48385         }
48386         FREE(counterparty_htlc_sigs);
48387         LDKPublicKey holder_funding_key_ref;
48388         CHECK(holder_funding_key->arr_len == 33);
48389         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
48390         LDKPublicKey counterparty_funding_key_ref;
48391         CHECK(counterparty_funding_key->arr_len == 33);
48392         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
48393         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
48394         uint64_t ret_ref = 0;
48395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48397         return ret_ref;
48398 }
48399
48400 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
48401         LDKBuiltCommitmentTransaction this_obj_conv;
48402         this_obj_conv.inner = untag_ptr(this_obj);
48403         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48405         BuiltCommitmentTransaction_free(this_obj_conv);
48406 }
48407
48408 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
48409         LDKBuiltCommitmentTransaction this_ptr_conv;
48410         this_ptr_conv.inner = untag_ptr(this_ptr);
48411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48413         this_ptr_conv.is_owned = false;
48414         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
48415         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48416         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48417         Transaction_free(ret_var);
48418         return ret_arr;
48419 }
48420
48421 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
48422         LDKBuiltCommitmentTransaction this_ptr_conv;
48423         this_ptr_conv.inner = untag_ptr(this_ptr);
48424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48426         this_ptr_conv.is_owned = false;
48427         LDKTransaction val_ref;
48428         val_ref.datalen = val->arr_len;
48429         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
48430         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48431         val_ref.data_is_owned = true;
48432         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
48433 }
48434
48435 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
48436         LDKBuiltCommitmentTransaction this_ptr_conv;
48437         this_ptr_conv.inner = untag_ptr(this_ptr);
48438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48440         this_ptr_conv.is_owned = false;
48441         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48442         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
48443         return ret_arr;
48444 }
48445
48446 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
48447         LDKBuiltCommitmentTransaction this_ptr_conv;
48448         this_ptr_conv.inner = untag_ptr(this_ptr);
48449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48451         this_ptr_conv.is_owned = false;
48452         LDKThirtyTwoBytes val_ref;
48453         CHECK(val->arr_len == 32);
48454         memcpy(val_ref.data, val->elems, 32); FREE(val);
48455         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
48456 }
48457
48458 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
48459         LDKTransaction transaction_arg_ref;
48460         transaction_arg_ref.datalen = transaction_arg->arr_len;
48461         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
48462         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
48463         transaction_arg_ref.data_is_owned = true;
48464         LDKThirtyTwoBytes txid_arg_ref;
48465         CHECK(txid_arg->arr_len == 32);
48466         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
48467         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
48468         uint64_t ret_ref = 0;
48469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48471         return ret_ref;
48472 }
48473
48474 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
48475         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
48476         uint64_t ret_ref = 0;
48477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48479         return ret_ref;
48480 }
48481 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
48482         LDKBuiltCommitmentTransaction arg_conv;
48483         arg_conv.inner = untag_ptr(arg);
48484         arg_conv.is_owned = ptr_is_owned(arg);
48485         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48486         arg_conv.is_owned = false;
48487         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
48488         return ret_conv;
48489 }
48490
48491 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
48492         LDKBuiltCommitmentTransaction orig_conv;
48493         orig_conv.inner = untag_ptr(orig);
48494         orig_conv.is_owned = ptr_is_owned(orig);
48495         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48496         orig_conv.is_owned = false;
48497         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
48498         uint64_t ret_ref = 0;
48499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48501         return ret_ref;
48502 }
48503
48504 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
48505         LDKBuiltCommitmentTransaction obj_conv;
48506         obj_conv.inner = untag_ptr(obj);
48507         obj_conv.is_owned = ptr_is_owned(obj);
48508         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48509         obj_conv.is_owned = false;
48510         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
48511         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48512         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48513         CVec_u8Z_free(ret_var);
48514         return ret_arr;
48515 }
48516
48517 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
48518         LDKu8slice ser_ref;
48519         ser_ref.datalen = ser->arr_len;
48520         ser_ref.data = ser->elems;
48521         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
48522         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
48523         FREE(ser);
48524         return tag_ptr(ret_conv, true);
48525 }
48526
48527 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) {
48528         LDKBuiltCommitmentTransaction this_arg_conv;
48529         this_arg_conv.inner = untag_ptr(this_arg);
48530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48532         this_arg_conv.is_owned = false;
48533         LDKu8slice funding_redeemscript_ref;
48534         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48535         funding_redeemscript_ref.data = funding_redeemscript->elems;
48536         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48537         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
48538         FREE(funding_redeemscript);
48539         return ret_arr;
48540 }
48541
48542 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) {
48543         LDKBuiltCommitmentTransaction this_arg_conv;
48544         this_arg_conv.inner = untag_ptr(this_arg);
48545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48547         this_arg_conv.is_owned = false;
48548         uint8_t funding_key_arr[32];
48549         CHECK(funding_key->arr_len == 32);
48550         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
48551         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
48552         LDKu8slice funding_redeemscript_ref;
48553         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48554         funding_redeemscript_ref.data = funding_redeemscript->elems;
48555         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48556         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
48557         FREE(funding_redeemscript);
48558         return ret_arr;
48559 }
48560
48561 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) {
48562         LDKBuiltCommitmentTransaction this_arg_conv;
48563         this_arg_conv.inner = untag_ptr(this_arg);
48564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48566         this_arg_conv.is_owned = false;
48567         uint8_t funding_key_arr[32];
48568         CHECK(funding_key->arr_len == 32);
48569         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
48570         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
48571         LDKu8slice funding_redeemscript_ref;
48572         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48573         funding_redeemscript_ref.data = funding_redeemscript->elems;
48574         void* entropy_source_ptr = untag_ptr(entropy_source);
48575         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
48576         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
48577         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48578         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);
48579         FREE(funding_redeemscript);
48580         return ret_arr;
48581 }
48582
48583 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
48584         LDKClosingTransaction this_obj_conv;
48585         this_obj_conv.inner = untag_ptr(this_obj);
48586         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48588         ClosingTransaction_free(this_obj_conv);
48589 }
48590
48591 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
48592         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
48593         uint64_t ret_ref = 0;
48594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48596         return ret_ref;
48597 }
48598 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
48599         LDKClosingTransaction arg_conv;
48600         arg_conv.inner = untag_ptr(arg);
48601         arg_conv.is_owned = ptr_is_owned(arg);
48602         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48603         arg_conv.is_owned = false;
48604         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
48605         return ret_conv;
48606 }
48607
48608 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
48609         LDKClosingTransaction orig_conv;
48610         orig_conv.inner = untag_ptr(orig);
48611         orig_conv.is_owned = ptr_is_owned(orig);
48612         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48613         orig_conv.is_owned = false;
48614         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
48615         uint64_t ret_ref = 0;
48616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48618         return ret_ref;
48619 }
48620
48621 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
48622         LDKClosingTransaction o_conv;
48623         o_conv.inner = untag_ptr(o);
48624         o_conv.is_owned = ptr_is_owned(o);
48625         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48626         o_conv.is_owned = false;
48627         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
48628         return ret_conv;
48629 }
48630
48631 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
48632         LDKClosingTransaction a_conv;
48633         a_conv.inner = untag_ptr(a);
48634         a_conv.is_owned = ptr_is_owned(a);
48635         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48636         a_conv.is_owned = false;
48637         LDKClosingTransaction b_conv;
48638         b_conv.inner = untag_ptr(b);
48639         b_conv.is_owned = ptr_is_owned(b);
48640         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48641         b_conv.is_owned = false;
48642         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
48643         return ret_conv;
48644 }
48645
48646 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) {
48647         LDKCVec_u8Z to_holder_script_ref;
48648         to_holder_script_ref.datalen = to_holder_script->arr_len;
48649         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
48650         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
48651         LDKCVec_u8Z to_counterparty_script_ref;
48652         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
48653         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
48654         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
48655         LDKOutPoint funding_outpoint_conv;
48656         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
48657         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
48658         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
48659         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
48660         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
48661         uint64_t ret_ref = 0;
48662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48664         return ret_ref;
48665 }
48666
48667 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
48668         LDKClosingTransaction this_arg_conv;
48669         this_arg_conv.inner = untag_ptr(this_arg);
48670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48672         this_arg_conv.is_owned = false;
48673         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
48674         uint64_t ret_ref = 0;
48675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48677         return ret_ref;
48678 }
48679
48680 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
48681         LDKClosingTransaction this_arg_conv;
48682         this_arg_conv.inner = untag_ptr(this_arg);
48683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48685         this_arg_conv.is_owned = false;
48686         LDKOutPoint funding_outpoint_conv;
48687         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
48688         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
48689         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
48690         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
48691         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
48692         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
48693         return tag_ptr(ret_conv, true);
48694 }
48695
48696 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
48697         LDKClosingTransaction this_arg_conv;
48698         this_arg_conv.inner = untag_ptr(this_arg);
48699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48701         this_arg_conv.is_owned = false;
48702         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
48703         return ret_conv;
48704 }
48705
48706 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
48707         LDKClosingTransaction 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         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
48713         return ret_conv;
48714 }
48715
48716 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
48717         LDKClosingTransaction 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         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
48723         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48724         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48725         return ret_arr;
48726 }
48727
48728 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
48729         LDKClosingTransaction this_arg_conv;
48730         this_arg_conv.inner = untag_ptr(this_arg);
48731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48733         this_arg_conv.is_owned = false;
48734         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
48735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48737         return ret_arr;
48738 }
48739
48740 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
48741         LDKTrustedClosingTransaction this_obj_conv;
48742         this_obj_conv.inner = untag_ptr(this_obj);
48743         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48745         TrustedClosingTransaction_free(this_obj_conv);
48746 }
48747
48748 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
48749         LDKTrustedClosingTransaction this_arg_conv;
48750         this_arg_conv.inner = untag_ptr(this_arg);
48751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48753         this_arg_conv.is_owned = false;
48754         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
48755         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48756         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48757         Transaction_free(ret_var);
48758         return ret_arr;
48759 }
48760
48761 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) {
48762         LDKTrustedClosingTransaction this_arg_conv;
48763         this_arg_conv.inner = untag_ptr(this_arg);
48764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48766         this_arg_conv.is_owned = false;
48767         LDKu8slice funding_redeemscript_ref;
48768         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48769         funding_redeemscript_ref.data = funding_redeemscript->elems;
48770         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48771         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
48772         FREE(funding_redeemscript);
48773         return ret_arr;
48774 }
48775
48776 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) {
48777         LDKTrustedClosingTransaction this_arg_conv;
48778         this_arg_conv.inner = untag_ptr(this_arg);
48779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48781         this_arg_conv.is_owned = false;
48782         uint8_t funding_key_arr[32];
48783         CHECK(funding_key->arr_len == 32);
48784         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
48785         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
48786         LDKu8slice funding_redeemscript_ref;
48787         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48788         funding_redeemscript_ref.data = funding_redeemscript->elems;
48789         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48790         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
48791         FREE(funding_redeemscript);
48792         return ret_arr;
48793 }
48794
48795 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
48796         LDKCommitmentTransaction this_obj_conv;
48797         this_obj_conv.inner = untag_ptr(this_obj);
48798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48800         CommitmentTransaction_free(this_obj_conv);
48801 }
48802
48803 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
48804         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
48805         uint64_t ret_ref = 0;
48806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48808         return ret_ref;
48809 }
48810 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
48811         LDKCommitmentTransaction arg_conv;
48812         arg_conv.inner = untag_ptr(arg);
48813         arg_conv.is_owned = ptr_is_owned(arg);
48814         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48815         arg_conv.is_owned = false;
48816         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
48817         return ret_conv;
48818 }
48819
48820 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
48821         LDKCommitmentTransaction orig_conv;
48822         orig_conv.inner = untag_ptr(orig);
48823         orig_conv.is_owned = ptr_is_owned(orig);
48824         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48825         orig_conv.is_owned = false;
48826         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
48827         uint64_t ret_ref = 0;
48828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48830         return ret_ref;
48831 }
48832
48833 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
48834         LDKCommitmentTransaction obj_conv;
48835         obj_conv.inner = untag_ptr(obj);
48836         obj_conv.is_owned = ptr_is_owned(obj);
48837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48838         obj_conv.is_owned = false;
48839         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
48840         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48841         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48842         CVec_u8Z_free(ret_var);
48843         return ret_arr;
48844 }
48845
48846 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
48847         LDKu8slice ser_ref;
48848         ser_ref.datalen = ser->arr_len;
48849         ser_ref.data = ser->elems;
48850         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
48851         *ret_conv = CommitmentTransaction_read(ser_ref);
48852         FREE(ser);
48853         return tag_ptr(ret_conv, true);
48854 }
48855
48856 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
48857         LDKCommitmentTransaction this_arg_conv;
48858         this_arg_conv.inner = untag_ptr(this_arg);
48859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48861         this_arg_conv.is_owned = false;
48862         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
48863         return ret_conv;
48864 }
48865
48866 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
48867         LDKCommitmentTransaction this_arg_conv;
48868         this_arg_conv.inner = untag_ptr(this_arg);
48869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48871         this_arg_conv.is_owned = false;
48872         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
48873         return ret_conv;
48874 }
48875
48876 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
48877         LDKCommitmentTransaction this_arg_conv;
48878         this_arg_conv.inner = untag_ptr(this_arg);
48879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48881         this_arg_conv.is_owned = false;
48882         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
48883         return ret_conv;
48884 }
48885
48886 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
48887         LDKCommitmentTransaction this_arg_conv;
48888         this_arg_conv.inner = untag_ptr(this_arg);
48889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48891         this_arg_conv.is_owned = false;
48892         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
48893         return ret_conv;
48894 }
48895
48896 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
48897         LDKCommitmentTransaction 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         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
48903         uint64_t ret_ref = 0;
48904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48906         return ret_ref;
48907 }
48908
48909 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) {
48910         LDKCommitmentTransaction this_arg_conv;
48911         this_arg_conv.inner = untag_ptr(this_arg);
48912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48914         this_arg_conv.is_owned = false;
48915         LDKDirectedChannelTransactionParameters channel_parameters_conv;
48916         channel_parameters_conv.inner = untag_ptr(channel_parameters);
48917         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
48918         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
48919         channel_parameters_conv.is_owned = false;
48920         LDKChannelPublicKeys broadcaster_keys_conv;
48921         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
48922         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
48923         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
48924         broadcaster_keys_conv.is_owned = false;
48925         LDKChannelPublicKeys countersignatory_keys_conv;
48926         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
48927         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
48928         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
48929         countersignatory_keys_conv.is_owned = false;
48930         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
48931         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
48932         return tag_ptr(ret_conv, true);
48933 }
48934
48935 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
48936         LDKTrustedCommitmentTransaction this_obj_conv;
48937         this_obj_conv.inner = untag_ptr(this_obj);
48938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48940         TrustedCommitmentTransaction_free(this_obj_conv);
48941 }
48942
48943 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
48944         LDKTrustedCommitmentTransaction 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48950         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
48951         return ret_arr;
48952 }
48953
48954 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
48955         LDKTrustedCommitmentTransaction this_arg_conv;
48956         this_arg_conv.inner = untag_ptr(this_arg);
48957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48959         this_arg_conv.is_owned = false;
48960         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
48961         uint64_t ret_ref = 0;
48962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48964         return ret_ref;
48965 }
48966
48967 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
48968         LDKTrustedCommitmentTransaction this_arg_conv;
48969         this_arg_conv.inner = untag_ptr(this_arg);
48970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48972         this_arg_conv.is_owned = false;
48973         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
48974         uint64_t ret_ref = 0;
48975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48977         return ret_ref;
48978 }
48979
48980 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
48981         LDKTrustedCommitmentTransaction this_arg_conv;
48982         this_arg_conv.inner = untag_ptr(this_arg);
48983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48985         this_arg_conv.is_owned = false;
48986         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
48987         uint64_t ret_ref = 0;
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48990         return ret_ref;
48991 }
48992
48993 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) {
48994         LDKTrustedCommitmentTransaction this_arg_conv;
48995         this_arg_conv.inner = untag_ptr(this_arg);
48996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48998         this_arg_conv.is_owned = false;
48999         uint8_t htlc_base_key_arr[32];
49000         CHECK(htlc_base_key->arr_len == 32);
49001         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
49002         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
49003         LDKDirectedChannelTransactionParameters channel_parameters_conv;
49004         channel_parameters_conv.inner = untag_ptr(channel_parameters);
49005         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
49006         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
49007         channel_parameters_conv.is_owned = false;
49008         void* entropy_source_ptr = untag_ptr(entropy_source);
49009         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49010         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49011         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
49012         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
49013         return tag_ptr(ret_conv, true);
49014 }
49015
49016 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
49017         LDKTrustedCommitmentTransaction this_arg_conv;
49018         this_arg_conv.inner = untag_ptr(this_arg);
49019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49021         this_arg_conv.is_owned = false;
49022         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
49023         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
49024         uint64_t ret_ref = tag_ptr(ret_copy, true);
49025         return ret_ref;
49026 }
49027
49028 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_build_to_local_justice_tx"))) TS_TrustedCommitmentTransaction_build_to_local_justice_tx(uint64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
49029         LDKTrustedCommitmentTransaction this_arg_conv;
49030         this_arg_conv.inner = untag_ptr(this_arg);
49031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49033         this_arg_conv.is_owned = false;
49034         LDKCVec_u8Z destination_script_ref;
49035         destination_script_ref.datalen = destination_script->arr_len;
49036         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
49037         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
49038         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
49039         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
49040         return tag_ptr(ret_conv, true);
49041 }
49042
49043 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) {
49044         LDKPublicKey broadcaster_payment_basepoint_ref;
49045         CHECK(broadcaster_payment_basepoint->arr_len == 33);
49046         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
49047         LDKPublicKey countersignatory_payment_basepoint_ref;
49048         CHECK(countersignatory_payment_basepoint->arr_len == 33);
49049         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
49050         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
49051         return ret_conv;
49052 }
49053
49054 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
49055         LDKInitFeatures a_conv;
49056         a_conv.inner = untag_ptr(a);
49057         a_conv.is_owned = ptr_is_owned(a);
49058         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49059         a_conv.is_owned = false;
49060         LDKInitFeatures b_conv;
49061         b_conv.inner = untag_ptr(b);
49062         b_conv.is_owned = ptr_is_owned(b);
49063         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49064         b_conv.is_owned = false;
49065         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
49066         return ret_conv;
49067 }
49068
49069 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
49070         LDKNodeFeatures a_conv;
49071         a_conv.inner = untag_ptr(a);
49072         a_conv.is_owned = ptr_is_owned(a);
49073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49074         a_conv.is_owned = false;
49075         LDKNodeFeatures b_conv;
49076         b_conv.inner = untag_ptr(b);
49077         b_conv.is_owned = ptr_is_owned(b);
49078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49079         b_conv.is_owned = false;
49080         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
49081         return ret_conv;
49082 }
49083
49084 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
49085         LDKChannelFeatures a_conv;
49086         a_conv.inner = untag_ptr(a);
49087         a_conv.is_owned = ptr_is_owned(a);
49088         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49089         a_conv.is_owned = false;
49090         LDKChannelFeatures b_conv;
49091         b_conv.inner = untag_ptr(b);
49092         b_conv.is_owned = ptr_is_owned(b);
49093         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49094         b_conv.is_owned = false;
49095         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
49096         return ret_conv;
49097 }
49098
49099 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
49100         LDKBolt11InvoiceFeatures a_conv;
49101         a_conv.inner = untag_ptr(a);
49102         a_conv.is_owned = ptr_is_owned(a);
49103         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49104         a_conv.is_owned = false;
49105         LDKBolt11InvoiceFeatures b_conv;
49106         b_conv.inner = untag_ptr(b);
49107         b_conv.is_owned = ptr_is_owned(b);
49108         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49109         b_conv.is_owned = false;
49110         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
49111         return ret_conv;
49112 }
49113
49114 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
49115         LDKOfferFeatures a_conv;
49116         a_conv.inner = untag_ptr(a);
49117         a_conv.is_owned = ptr_is_owned(a);
49118         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49119         a_conv.is_owned = false;
49120         LDKOfferFeatures b_conv;
49121         b_conv.inner = untag_ptr(b);
49122         b_conv.is_owned = ptr_is_owned(b);
49123         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49124         b_conv.is_owned = false;
49125         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
49126         return ret_conv;
49127 }
49128
49129 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
49130         LDKInvoiceRequestFeatures a_conv;
49131         a_conv.inner = untag_ptr(a);
49132         a_conv.is_owned = ptr_is_owned(a);
49133         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49134         a_conv.is_owned = false;
49135         LDKInvoiceRequestFeatures b_conv;
49136         b_conv.inner = untag_ptr(b);
49137         b_conv.is_owned = ptr_is_owned(b);
49138         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49139         b_conv.is_owned = false;
49140         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
49141         return ret_conv;
49142 }
49143
49144 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
49145         LDKBolt12InvoiceFeatures a_conv;
49146         a_conv.inner = untag_ptr(a);
49147         a_conv.is_owned = ptr_is_owned(a);
49148         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49149         a_conv.is_owned = false;
49150         LDKBolt12InvoiceFeatures b_conv;
49151         b_conv.inner = untag_ptr(b);
49152         b_conv.is_owned = ptr_is_owned(b);
49153         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49154         b_conv.is_owned = false;
49155         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
49156         return ret_conv;
49157 }
49158
49159 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
49160         LDKBlindedHopFeatures a_conv;
49161         a_conv.inner = untag_ptr(a);
49162         a_conv.is_owned = ptr_is_owned(a);
49163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49164         a_conv.is_owned = false;
49165         LDKBlindedHopFeatures b_conv;
49166         b_conv.inner = untag_ptr(b);
49167         b_conv.is_owned = ptr_is_owned(b);
49168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49169         b_conv.is_owned = false;
49170         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
49171         return ret_conv;
49172 }
49173
49174 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
49175         LDKChannelTypeFeatures a_conv;
49176         a_conv.inner = untag_ptr(a);
49177         a_conv.is_owned = ptr_is_owned(a);
49178         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49179         a_conv.is_owned = false;
49180         LDKChannelTypeFeatures b_conv;
49181         b_conv.inner = untag_ptr(b);
49182         b_conv.is_owned = ptr_is_owned(b);
49183         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49184         b_conv.is_owned = false;
49185         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
49186         return ret_conv;
49187 }
49188
49189 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
49190         LDKInitFeatures ret_var = InitFeatures_clone(arg);
49191         uint64_t ret_ref = 0;
49192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49194         return ret_ref;
49195 }
49196 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
49197         LDKInitFeatures arg_conv;
49198         arg_conv.inner = untag_ptr(arg);
49199         arg_conv.is_owned = ptr_is_owned(arg);
49200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49201         arg_conv.is_owned = false;
49202         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
49203         return ret_conv;
49204 }
49205
49206 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
49207         LDKInitFeatures orig_conv;
49208         orig_conv.inner = untag_ptr(orig);
49209         orig_conv.is_owned = ptr_is_owned(orig);
49210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49211         orig_conv.is_owned = false;
49212         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
49213         uint64_t ret_ref = 0;
49214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49216         return ret_ref;
49217 }
49218
49219 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
49220         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
49221         uint64_t ret_ref = 0;
49222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49224         return ret_ref;
49225 }
49226 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
49227         LDKNodeFeatures arg_conv;
49228         arg_conv.inner = untag_ptr(arg);
49229         arg_conv.is_owned = ptr_is_owned(arg);
49230         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49231         arg_conv.is_owned = false;
49232         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
49233         return ret_conv;
49234 }
49235
49236 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
49237         LDKNodeFeatures orig_conv;
49238         orig_conv.inner = untag_ptr(orig);
49239         orig_conv.is_owned = ptr_is_owned(orig);
49240         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49241         orig_conv.is_owned = false;
49242         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
49243         uint64_t ret_ref = 0;
49244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49246         return ret_ref;
49247 }
49248
49249 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
49250         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
49251         uint64_t ret_ref = 0;
49252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49254         return ret_ref;
49255 }
49256 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
49257         LDKChannelFeatures arg_conv;
49258         arg_conv.inner = untag_ptr(arg);
49259         arg_conv.is_owned = ptr_is_owned(arg);
49260         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49261         arg_conv.is_owned = false;
49262         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
49263         return ret_conv;
49264 }
49265
49266 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
49267         LDKChannelFeatures orig_conv;
49268         orig_conv.inner = untag_ptr(orig);
49269         orig_conv.is_owned = ptr_is_owned(orig);
49270         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49271         orig_conv.is_owned = false;
49272         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
49273         uint64_t ret_ref = 0;
49274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49276         return ret_ref;
49277 }
49278
49279 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
49280         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
49281         uint64_t ret_ref = 0;
49282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49284         return ret_ref;
49285 }
49286 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
49287         LDKBolt11InvoiceFeatures arg_conv;
49288         arg_conv.inner = untag_ptr(arg);
49289         arg_conv.is_owned = ptr_is_owned(arg);
49290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49291         arg_conv.is_owned = false;
49292         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
49293         return ret_conv;
49294 }
49295
49296 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
49297         LDKBolt11InvoiceFeatures orig_conv;
49298         orig_conv.inner = untag_ptr(orig);
49299         orig_conv.is_owned = ptr_is_owned(orig);
49300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49301         orig_conv.is_owned = false;
49302         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
49303         uint64_t ret_ref = 0;
49304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49306         return ret_ref;
49307 }
49308
49309 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
49310         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
49311         uint64_t ret_ref = 0;
49312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49314         return ret_ref;
49315 }
49316 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
49317         LDKOfferFeatures arg_conv;
49318         arg_conv.inner = untag_ptr(arg);
49319         arg_conv.is_owned = ptr_is_owned(arg);
49320         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49321         arg_conv.is_owned = false;
49322         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
49323         return ret_conv;
49324 }
49325
49326 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
49327         LDKOfferFeatures orig_conv;
49328         orig_conv.inner = untag_ptr(orig);
49329         orig_conv.is_owned = ptr_is_owned(orig);
49330         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49331         orig_conv.is_owned = false;
49332         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
49333         uint64_t ret_ref = 0;
49334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49336         return ret_ref;
49337 }
49338
49339 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
49340         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
49341         uint64_t ret_ref = 0;
49342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49344         return ret_ref;
49345 }
49346 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
49347         LDKInvoiceRequestFeatures arg_conv;
49348         arg_conv.inner = untag_ptr(arg);
49349         arg_conv.is_owned = ptr_is_owned(arg);
49350         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49351         arg_conv.is_owned = false;
49352         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
49353         return ret_conv;
49354 }
49355
49356 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
49357         LDKInvoiceRequestFeatures orig_conv;
49358         orig_conv.inner = untag_ptr(orig);
49359         orig_conv.is_owned = ptr_is_owned(orig);
49360         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49361         orig_conv.is_owned = false;
49362         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
49363         uint64_t ret_ref = 0;
49364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49366         return ret_ref;
49367 }
49368
49369 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
49370         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
49371         uint64_t ret_ref = 0;
49372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49374         return ret_ref;
49375 }
49376 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
49377         LDKBolt12InvoiceFeatures arg_conv;
49378         arg_conv.inner = untag_ptr(arg);
49379         arg_conv.is_owned = ptr_is_owned(arg);
49380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49381         arg_conv.is_owned = false;
49382         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
49383         return ret_conv;
49384 }
49385
49386 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
49387         LDKBolt12InvoiceFeatures orig_conv;
49388         orig_conv.inner = untag_ptr(orig);
49389         orig_conv.is_owned = ptr_is_owned(orig);
49390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49391         orig_conv.is_owned = false;
49392         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
49393         uint64_t ret_ref = 0;
49394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49396         return ret_ref;
49397 }
49398
49399 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
49400         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
49401         uint64_t ret_ref = 0;
49402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49404         return ret_ref;
49405 }
49406 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
49407         LDKBlindedHopFeatures arg_conv;
49408         arg_conv.inner = untag_ptr(arg);
49409         arg_conv.is_owned = ptr_is_owned(arg);
49410         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49411         arg_conv.is_owned = false;
49412         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
49413         return ret_conv;
49414 }
49415
49416 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
49417         LDKBlindedHopFeatures orig_conv;
49418         orig_conv.inner = untag_ptr(orig);
49419         orig_conv.is_owned = ptr_is_owned(orig);
49420         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49421         orig_conv.is_owned = false;
49422         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
49423         uint64_t ret_ref = 0;
49424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49426         return ret_ref;
49427 }
49428
49429 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
49430         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
49431         uint64_t ret_ref = 0;
49432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49434         return ret_ref;
49435 }
49436 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
49437         LDKChannelTypeFeatures arg_conv;
49438         arg_conv.inner = untag_ptr(arg);
49439         arg_conv.is_owned = ptr_is_owned(arg);
49440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49441         arg_conv.is_owned = false;
49442         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
49443         return ret_conv;
49444 }
49445
49446 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
49447         LDKChannelTypeFeatures orig_conv;
49448         orig_conv.inner = untag_ptr(orig);
49449         orig_conv.is_owned = ptr_is_owned(orig);
49450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49451         orig_conv.is_owned = false;
49452         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
49453         uint64_t ret_ref = 0;
49454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49456         return ret_ref;
49457 }
49458
49459 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
49460         LDKInitFeatures this_obj_conv;
49461         this_obj_conv.inner = untag_ptr(this_obj);
49462         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49464         InitFeatures_free(this_obj_conv);
49465 }
49466
49467 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
49468         LDKNodeFeatures this_obj_conv;
49469         this_obj_conv.inner = untag_ptr(this_obj);
49470         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49472         NodeFeatures_free(this_obj_conv);
49473 }
49474
49475 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
49476         LDKChannelFeatures this_obj_conv;
49477         this_obj_conv.inner = untag_ptr(this_obj);
49478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49480         ChannelFeatures_free(this_obj_conv);
49481 }
49482
49483 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
49484         LDKBolt11InvoiceFeatures this_obj_conv;
49485         this_obj_conv.inner = untag_ptr(this_obj);
49486         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49488         Bolt11InvoiceFeatures_free(this_obj_conv);
49489 }
49490
49491 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
49492         LDKOfferFeatures this_obj_conv;
49493         this_obj_conv.inner = untag_ptr(this_obj);
49494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49496         OfferFeatures_free(this_obj_conv);
49497 }
49498
49499 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
49500         LDKInvoiceRequestFeatures this_obj_conv;
49501         this_obj_conv.inner = untag_ptr(this_obj);
49502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49504         InvoiceRequestFeatures_free(this_obj_conv);
49505 }
49506
49507 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
49508         LDKBolt12InvoiceFeatures this_obj_conv;
49509         this_obj_conv.inner = untag_ptr(this_obj);
49510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49512         Bolt12InvoiceFeatures_free(this_obj_conv);
49513 }
49514
49515 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
49516         LDKBlindedHopFeatures this_obj_conv;
49517         this_obj_conv.inner = untag_ptr(this_obj);
49518         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49520         BlindedHopFeatures_free(this_obj_conv);
49521 }
49522
49523 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
49524         LDKChannelTypeFeatures this_obj_conv;
49525         this_obj_conv.inner = untag_ptr(this_obj);
49526         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49528         ChannelTypeFeatures_free(this_obj_conv);
49529 }
49530
49531 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
49532         LDKInitFeatures ret_var = InitFeatures_empty();
49533         uint64_t ret_ref = 0;
49534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49536         return ret_ref;
49537 }
49538
49539 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49540         LDKInitFeatures this_arg_conv;
49541         this_arg_conv.inner = untag_ptr(this_arg);
49542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49544         this_arg_conv.is_owned = false;
49545         LDKInitFeatures other_conv;
49546         other_conv.inner = untag_ptr(other);
49547         other_conv.is_owned = ptr_is_owned(other);
49548         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49549         other_conv.is_owned = false;
49550         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49551         return ret_conv;
49552 }
49553
49554 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
49555         LDKInitFeatures this_arg_conv;
49556         this_arg_conv.inner = untag_ptr(this_arg);
49557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49559         this_arg_conv.is_owned = false;
49560         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
49561         return ret_conv;
49562 }
49563
49564 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49565         LDKInitFeatures this_arg_conv;
49566         this_arg_conv.inner = untag_ptr(this_arg);
49567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49569         this_arg_conv.is_owned = false;
49570         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49571         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
49572         return tag_ptr(ret_conv, true);
49573 }
49574
49575 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49576         LDKInitFeatures this_arg_conv;
49577         this_arg_conv.inner = untag_ptr(this_arg);
49578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49580         this_arg_conv.is_owned = false;
49581         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49582         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49583         return tag_ptr(ret_conv, true);
49584 }
49585
49586 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49587         LDKInitFeatures this_arg_conv;
49588         this_arg_conv.inner = untag_ptr(this_arg);
49589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49591         this_arg_conv.is_owned = false;
49592         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49593         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
49594         return tag_ptr(ret_conv, true);
49595 }
49596
49597 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49598         LDKInitFeatures this_arg_conv;
49599         this_arg_conv.inner = untag_ptr(this_arg);
49600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49602         this_arg_conv.is_owned = false;
49603         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49604         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49605         return tag_ptr(ret_conv, true);
49606 }
49607
49608 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
49609         LDKNodeFeatures ret_var = NodeFeatures_empty();
49610         uint64_t ret_ref = 0;
49611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49613         return ret_ref;
49614 }
49615
49616 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49617         LDKNodeFeatures this_arg_conv;
49618         this_arg_conv.inner = untag_ptr(this_arg);
49619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49621         this_arg_conv.is_owned = false;
49622         LDKNodeFeatures other_conv;
49623         other_conv.inner = untag_ptr(other);
49624         other_conv.is_owned = ptr_is_owned(other);
49625         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49626         other_conv.is_owned = false;
49627         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49628         return ret_conv;
49629 }
49630
49631 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
49632         LDKNodeFeatures this_arg_conv;
49633         this_arg_conv.inner = untag_ptr(this_arg);
49634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49636         this_arg_conv.is_owned = false;
49637         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
49638         return ret_conv;
49639 }
49640
49641 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49642         LDKNodeFeatures this_arg_conv;
49643         this_arg_conv.inner = untag_ptr(this_arg);
49644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49646         this_arg_conv.is_owned = false;
49647         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49648         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
49649         return tag_ptr(ret_conv, true);
49650 }
49651
49652 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49653         LDKNodeFeatures this_arg_conv;
49654         this_arg_conv.inner = untag_ptr(this_arg);
49655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49657         this_arg_conv.is_owned = false;
49658         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49659         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49660         return tag_ptr(ret_conv, true);
49661 }
49662
49663 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49664         LDKNodeFeatures this_arg_conv;
49665         this_arg_conv.inner = untag_ptr(this_arg);
49666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49668         this_arg_conv.is_owned = false;
49669         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49670         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
49671         return tag_ptr(ret_conv, true);
49672 }
49673
49674 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49675         LDKNodeFeatures this_arg_conv;
49676         this_arg_conv.inner = untag_ptr(this_arg);
49677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49679         this_arg_conv.is_owned = false;
49680         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49681         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49682         return tag_ptr(ret_conv, true);
49683 }
49684
49685 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
49686         LDKChannelFeatures ret_var = ChannelFeatures_empty();
49687         uint64_t ret_ref = 0;
49688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49690         return ret_ref;
49691 }
49692
49693 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49694         LDKChannelFeatures this_arg_conv;
49695         this_arg_conv.inner = untag_ptr(this_arg);
49696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49698         this_arg_conv.is_owned = false;
49699         LDKChannelFeatures other_conv;
49700         other_conv.inner = untag_ptr(other);
49701         other_conv.is_owned = ptr_is_owned(other);
49702         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49703         other_conv.is_owned = false;
49704         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49705         return ret_conv;
49706 }
49707
49708 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
49709         LDKChannelFeatures this_arg_conv;
49710         this_arg_conv.inner = untag_ptr(this_arg);
49711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49713         this_arg_conv.is_owned = false;
49714         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
49715         return ret_conv;
49716 }
49717
49718 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49719         LDKChannelFeatures this_arg_conv;
49720         this_arg_conv.inner = untag_ptr(this_arg);
49721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49723         this_arg_conv.is_owned = false;
49724         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49725         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
49726         return tag_ptr(ret_conv, true);
49727 }
49728
49729 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49730         LDKChannelFeatures this_arg_conv;
49731         this_arg_conv.inner = untag_ptr(this_arg);
49732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49734         this_arg_conv.is_owned = false;
49735         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49736         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49737         return tag_ptr(ret_conv, true);
49738 }
49739
49740 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49741         LDKChannelFeatures this_arg_conv;
49742         this_arg_conv.inner = untag_ptr(this_arg);
49743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49745         this_arg_conv.is_owned = false;
49746         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49747         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
49748         return tag_ptr(ret_conv, true);
49749 }
49750
49751 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49752         LDKChannelFeatures this_arg_conv;
49753         this_arg_conv.inner = untag_ptr(this_arg);
49754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49756         this_arg_conv.is_owned = false;
49757         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49758         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49759         return tag_ptr(ret_conv, true);
49760 }
49761
49762 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
49763         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
49764         uint64_t ret_ref = 0;
49765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49767         return ret_ref;
49768 }
49769
49770 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49771         LDKBolt11InvoiceFeatures this_arg_conv;
49772         this_arg_conv.inner = untag_ptr(this_arg);
49773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49775         this_arg_conv.is_owned = false;
49776         LDKBolt11InvoiceFeatures other_conv;
49777         other_conv.inner = untag_ptr(other);
49778         other_conv.is_owned = ptr_is_owned(other);
49779         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49780         other_conv.is_owned = false;
49781         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49782         return ret_conv;
49783 }
49784
49785 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
49786         LDKBolt11InvoiceFeatures this_arg_conv;
49787         this_arg_conv.inner = untag_ptr(this_arg);
49788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49790         this_arg_conv.is_owned = false;
49791         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
49792         return ret_conv;
49793 }
49794
49795 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49796         LDKBolt11InvoiceFeatures this_arg_conv;
49797         this_arg_conv.inner = untag_ptr(this_arg);
49798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49800         this_arg_conv.is_owned = false;
49801         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49802         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
49803         return tag_ptr(ret_conv, true);
49804 }
49805
49806 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49807         LDKBolt11InvoiceFeatures this_arg_conv;
49808         this_arg_conv.inner = untag_ptr(this_arg);
49809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49811         this_arg_conv.is_owned = false;
49812         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49813         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49814         return tag_ptr(ret_conv, true);
49815 }
49816
49817 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49818         LDKBolt11InvoiceFeatures this_arg_conv;
49819         this_arg_conv.inner = untag_ptr(this_arg);
49820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49822         this_arg_conv.is_owned = false;
49823         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49824         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
49825         return tag_ptr(ret_conv, true);
49826 }
49827
49828 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49829         LDKBolt11InvoiceFeatures this_arg_conv;
49830         this_arg_conv.inner = untag_ptr(this_arg);
49831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49833         this_arg_conv.is_owned = false;
49834         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49835         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49836         return tag_ptr(ret_conv, true);
49837 }
49838
49839 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
49840         LDKOfferFeatures ret_var = OfferFeatures_empty();
49841         uint64_t ret_ref = 0;
49842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49844         return ret_ref;
49845 }
49846
49847 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49848         LDKOfferFeatures this_arg_conv;
49849         this_arg_conv.inner = untag_ptr(this_arg);
49850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49852         this_arg_conv.is_owned = false;
49853         LDKOfferFeatures other_conv;
49854         other_conv.inner = untag_ptr(other);
49855         other_conv.is_owned = ptr_is_owned(other);
49856         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49857         other_conv.is_owned = false;
49858         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49859         return ret_conv;
49860 }
49861
49862 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
49863         LDKOfferFeatures this_arg_conv;
49864         this_arg_conv.inner = untag_ptr(this_arg);
49865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49867         this_arg_conv.is_owned = false;
49868         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
49869         return ret_conv;
49870 }
49871
49872 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49873         LDKOfferFeatures this_arg_conv;
49874         this_arg_conv.inner = untag_ptr(this_arg);
49875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49877         this_arg_conv.is_owned = false;
49878         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49879         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
49880         return tag_ptr(ret_conv, true);
49881 }
49882
49883 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49884         LDKOfferFeatures this_arg_conv;
49885         this_arg_conv.inner = untag_ptr(this_arg);
49886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49888         this_arg_conv.is_owned = false;
49889         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49890         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49891         return tag_ptr(ret_conv, true);
49892 }
49893
49894 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49895         LDKOfferFeatures this_arg_conv;
49896         this_arg_conv.inner = untag_ptr(this_arg);
49897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49899         this_arg_conv.is_owned = false;
49900         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49901         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
49902         return tag_ptr(ret_conv, true);
49903 }
49904
49905 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49906         LDKOfferFeatures this_arg_conv;
49907         this_arg_conv.inner = untag_ptr(this_arg);
49908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49910         this_arg_conv.is_owned = false;
49911         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49912         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49913         return tag_ptr(ret_conv, true);
49914 }
49915
49916 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
49917         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
49918         uint64_t ret_ref = 0;
49919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49921         return ret_ref;
49922 }
49923
49924 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49925         LDKInvoiceRequestFeatures this_arg_conv;
49926         this_arg_conv.inner = untag_ptr(this_arg);
49927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49929         this_arg_conv.is_owned = false;
49930         LDKInvoiceRequestFeatures other_conv;
49931         other_conv.inner = untag_ptr(other);
49932         other_conv.is_owned = ptr_is_owned(other);
49933         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49934         other_conv.is_owned = false;
49935         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49936         return ret_conv;
49937 }
49938
49939 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
49940         LDKInvoiceRequestFeatures this_arg_conv;
49941         this_arg_conv.inner = untag_ptr(this_arg);
49942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49944         this_arg_conv.is_owned = false;
49945         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
49946         return ret_conv;
49947 }
49948
49949 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49950         LDKInvoiceRequestFeatures this_arg_conv;
49951         this_arg_conv.inner = untag_ptr(this_arg);
49952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49954         this_arg_conv.is_owned = false;
49955         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49956         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
49957         return tag_ptr(ret_conv, true);
49958 }
49959
49960 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49961         LDKInvoiceRequestFeatures this_arg_conv;
49962         this_arg_conv.inner = untag_ptr(this_arg);
49963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49965         this_arg_conv.is_owned = false;
49966         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49967         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49968         return tag_ptr(ret_conv, true);
49969 }
49970
49971 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49972         LDKInvoiceRequestFeatures this_arg_conv;
49973         this_arg_conv.inner = untag_ptr(this_arg);
49974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49976         this_arg_conv.is_owned = false;
49977         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49978         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
49979         return tag_ptr(ret_conv, true);
49980 }
49981
49982 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49983         LDKInvoiceRequestFeatures this_arg_conv;
49984         this_arg_conv.inner = untag_ptr(this_arg);
49985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49987         this_arg_conv.is_owned = false;
49988         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49989         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49990         return tag_ptr(ret_conv, true);
49991 }
49992
49993 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
49994         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
49995         uint64_t ret_ref = 0;
49996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49998         return ret_ref;
49999 }
50000
50001 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50002         LDKBolt12InvoiceFeatures this_arg_conv;
50003         this_arg_conv.inner = untag_ptr(this_arg);
50004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50006         this_arg_conv.is_owned = false;
50007         LDKBolt12InvoiceFeatures other_conv;
50008         other_conv.inner = untag_ptr(other);
50009         other_conv.is_owned = ptr_is_owned(other);
50010         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50011         other_conv.is_owned = false;
50012         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50013         return ret_conv;
50014 }
50015
50016 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
50017         LDKBolt12InvoiceFeatures this_arg_conv;
50018         this_arg_conv.inner = untag_ptr(this_arg);
50019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50021         this_arg_conv.is_owned = false;
50022         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
50023         return ret_conv;
50024 }
50025
50026 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50027         LDKBolt12InvoiceFeatures this_arg_conv;
50028         this_arg_conv.inner = untag_ptr(this_arg);
50029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50031         this_arg_conv.is_owned = false;
50032         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50033         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
50034         return tag_ptr(ret_conv, true);
50035 }
50036
50037 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50038         LDKBolt12InvoiceFeatures this_arg_conv;
50039         this_arg_conv.inner = untag_ptr(this_arg);
50040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50042         this_arg_conv.is_owned = false;
50043         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50044         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50045         return tag_ptr(ret_conv, true);
50046 }
50047
50048 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50049         LDKBolt12InvoiceFeatures this_arg_conv;
50050         this_arg_conv.inner = untag_ptr(this_arg);
50051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50053         this_arg_conv.is_owned = false;
50054         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50055         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
50056         return tag_ptr(ret_conv, true);
50057 }
50058
50059 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50060         LDKBolt12InvoiceFeatures this_arg_conv;
50061         this_arg_conv.inner = untag_ptr(this_arg);
50062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50064         this_arg_conv.is_owned = false;
50065         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50066         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50067         return tag_ptr(ret_conv, true);
50068 }
50069
50070 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
50071         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
50072         uint64_t ret_ref = 0;
50073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50075         return ret_ref;
50076 }
50077
50078 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50079         LDKBlindedHopFeatures this_arg_conv;
50080         this_arg_conv.inner = untag_ptr(this_arg);
50081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50083         this_arg_conv.is_owned = false;
50084         LDKBlindedHopFeatures other_conv;
50085         other_conv.inner = untag_ptr(other);
50086         other_conv.is_owned = ptr_is_owned(other);
50087         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50088         other_conv.is_owned = false;
50089         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50090         return ret_conv;
50091 }
50092
50093 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
50094         LDKBlindedHopFeatures this_arg_conv;
50095         this_arg_conv.inner = untag_ptr(this_arg);
50096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50098         this_arg_conv.is_owned = false;
50099         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
50100         return ret_conv;
50101 }
50102
50103 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50104         LDKBlindedHopFeatures this_arg_conv;
50105         this_arg_conv.inner = untag_ptr(this_arg);
50106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50108         this_arg_conv.is_owned = false;
50109         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50110         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
50111         return tag_ptr(ret_conv, true);
50112 }
50113
50114 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50115         LDKBlindedHopFeatures this_arg_conv;
50116         this_arg_conv.inner = untag_ptr(this_arg);
50117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50119         this_arg_conv.is_owned = false;
50120         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50121         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50122         return tag_ptr(ret_conv, true);
50123 }
50124
50125 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50126         LDKBlindedHopFeatures this_arg_conv;
50127         this_arg_conv.inner = untag_ptr(this_arg);
50128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50130         this_arg_conv.is_owned = false;
50131         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50132         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
50133         return tag_ptr(ret_conv, true);
50134 }
50135
50136 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50137         LDKBlindedHopFeatures this_arg_conv;
50138         this_arg_conv.inner = untag_ptr(this_arg);
50139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50141         this_arg_conv.is_owned = false;
50142         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50143         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50144         return tag_ptr(ret_conv, true);
50145 }
50146
50147 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
50148         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
50149         uint64_t ret_ref = 0;
50150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50152         return ret_ref;
50153 }
50154
50155 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50156         LDKChannelTypeFeatures this_arg_conv;
50157         this_arg_conv.inner = untag_ptr(this_arg);
50158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50160         this_arg_conv.is_owned = false;
50161         LDKChannelTypeFeatures other_conv;
50162         other_conv.inner = untag_ptr(other);
50163         other_conv.is_owned = ptr_is_owned(other);
50164         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50165         other_conv.is_owned = false;
50166         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50167         return ret_conv;
50168 }
50169
50170 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
50171         LDKChannelTypeFeatures this_arg_conv;
50172         this_arg_conv.inner = untag_ptr(this_arg);
50173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50175         this_arg_conv.is_owned = false;
50176         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
50177         return ret_conv;
50178 }
50179
50180 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50181         LDKChannelTypeFeatures this_arg_conv;
50182         this_arg_conv.inner = untag_ptr(this_arg);
50183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50185         this_arg_conv.is_owned = false;
50186         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50187         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
50188         return tag_ptr(ret_conv, true);
50189 }
50190
50191 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50192         LDKChannelTypeFeatures this_arg_conv;
50193         this_arg_conv.inner = untag_ptr(this_arg);
50194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50196         this_arg_conv.is_owned = false;
50197         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50198         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50199         return tag_ptr(ret_conv, true);
50200 }
50201
50202 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50203         LDKChannelTypeFeatures this_arg_conv;
50204         this_arg_conv.inner = untag_ptr(this_arg);
50205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50207         this_arg_conv.is_owned = false;
50208         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50209         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
50210         return tag_ptr(ret_conv, true);
50211 }
50212
50213 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50214         LDKChannelTypeFeatures this_arg_conv;
50215         this_arg_conv.inner = untag_ptr(this_arg);
50216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50218         this_arg_conv.is_owned = false;
50219         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50220         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50221         return tag_ptr(ret_conv, true);
50222 }
50223
50224 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
50225         LDKInitFeatures obj_conv;
50226         obj_conv.inner = untag_ptr(obj);
50227         obj_conv.is_owned = ptr_is_owned(obj);
50228         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50229         obj_conv.is_owned = false;
50230         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
50231         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50232         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50233         CVec_u8Z_free(ret_var);
50234         return ret_arr;
50235 }
50236
50237 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
50238         LDKu8slice ser_ref;
50239         ser_ref.datalen = ser->arr_len;
50240         ser_ref.data = ser->elems;
50241         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
50242         *ret_conv = InitFeatures_read(ser_ref);
50243         FREE(ser);
50244         return tag_ptr(ret_conv, true);
50245 }
50246
50247 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
50248         LDKChannelFeatures obj_conv;
50249         obj_conv.inner = untag_ptr(obj);
50250         obj_conv.is_owned = ptr_is_owned(obj);
50251         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50252         obj_conv.is_owned = false;
50253         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
50254         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50255         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50256         CVec_u8Z_free(ret_var);
50257         return ret_arr;
50258 }
50259
50260 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
50261         LDKu8slice ser_ref;
50262         ser_ref.datalen = ser->arr_len;
50263         ser_ref.data = ser->elems;
50264         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
50265         *ret_conv = ChannelFeatures_read(ser_ref);
50266         FREE(ser);
50267         return tag_ptr(ret_conv, true);
50268 }
50269
50270 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
50271         LDKNodeFeatures obj_conv;
50272         obj_conv.inner = untag_ptr(obj);
50273         obj_conv.is_owned = ptr_is_owned(obj);
50274         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50275         obj_conv.is_owned = false;
50276         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
50277         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50278         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50279         CVec_u8Z_free(ret_var);
50280         return ret_arr;
50281 }
50282
50283 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
50284         LDKu8slice ser_ref;
50285         ser_ref.datalen = ser->arr_len;
50286         ser_ref.data = ser->elems;
50287         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
50288         *ret_conv = NodeFeatures_read(ser_ref);
50289         FREE(ser);
50290         return tag_ptr(ret_conv, true);
50291 }
50292
50293 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
50294         LDKBolt11InvoiceFeatures obj_conv;
50295         obj_conv.inner = untag_ptr(obj);
50296         obj_conv.is_owned = ptr_is_owned(obj);
50297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50298         obj_conv.is_owned = false;
50299         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
50300         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50301         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50302         CVec_u8Z_free(ret_var);
50303         return ret_arr;
50304 }
50305
50306 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
50307         LDKu8slice ser_ref;
50308         ser_ref.datalen = ser->arr_len;
50309         ser_ref.data = ser->elems;
50310         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
50311         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
50312         FREE(ser);
50313         return tag_ptr(ret_conv, true);
50314 }
50315
50316 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
50317         LDKBolt12InvoiceFeatures obj_conv;
50318         obj_conv.inner = untag_ptr(obj);
50319         obj_conv.is_owned = ptr_is_owned(obj);
50320         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50321         obj_conv.is_owned = false;
50322         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
50323         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50324         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50325         CVec_u8Z_free(ret_var);
50326         return ret_arr;
50327 }
50328
50329 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
50330         LDKu8slice ser_ref;
50331         ser_ref.datalen = ser->arr_len;
50332         ser_ref.data = ser->elems;
50333         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
50334         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
50335         FREE(ser);
50336         return tag_ptr(ret_conv, true);
50337 }
50338
50339 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
50340         LDKBlindedHopFeatures obj_conv;
50341         obj_conv.inner = untag_ptr(obj);
50342         obj_conv.is_owned = ptr_is_owned(obj);
50343         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50344         obj_conv.is_owned = false;
50345         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
50346         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50347         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50348         CVec_u8Z_free(ret_var);
50349         return ret_arr;
50350 }
50351
50352 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
50353         LDKu8slice ser_ref;
50354         ser_ref.datalen = ser->arr_len;
50355         ser_ref.data = ser->elems;
50356         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
50357         *ret_conv = BlindedHopFeatures_read(ser_ref);
50358         FREE(ser);
50359         return tag_ptr(ret_conv, true);
50360 }
50361
50362 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
50363         LDKChannelTypeFeatures obj_conv;
50364         obj_conv.inner = untag_ptr(obj);
50365         obj_conv.is_owned = ptr_is_owned(obj);
50366         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50367         obj_conv.is_owned = false;
50368         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
50369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50371         CVec_u8Z_free(ret_var);
50372         return ret_arr;
50373 }
50374
50375 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
50376         LDKu8slice ser_ref;
50377         ser_ref.datalen = ser->arr_len;
50378         ser_ref.data = ser->elems;
50379         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
50380         *ret_conv = ChannelTypeFeatures_read(ser_ref);
50381         FREE(ser);
50382         return tag_ptr(ret_conv, true);
50383 }
50384
50385 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
50386         LDKInitFeatures this_arg_conv;
50387         this_arg_conv.inner = untag_ptr(this_arg);
50388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50390         this_arg_conv.is_owned = false;
50391         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
50392 }
50393
50394 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
50395         LDKInitFeatures this_arg_conv;
50396         this_arg_conv.inner = untag_ptr(this_arg);
50397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50399         this_arg_conv.is_owned = false;
50400         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
50401 }
50402
50403 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
50404         LDKInitFeatures this_arg_conv;
50405         this_arg_conv.inner = untag_ptr(this_arg);
50406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50408         this_arg_conv.is_owned = false;
50409         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
50410         return ret_conv;
50411 }
50412
50413 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
50414         LDKNodeFeatures this_arg_conv;
50415         this_arg_conv.inner = untag_ptr(this_arg);
50416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50418         this_arg_conv.is_owned = false;
50419         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
50420 }
50421
50422 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
50423         LDKNodeFeatures this_arg_conv;
50424         this_arg_conv.inner = untag_ptr(this_arg);
50425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50427         this_arg_conv.is_owned = false;
50428         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
50429 }
50430
50431 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
50432         LDKNodeFeatures this_arg_conv;
50433         this_arg_conv.inner = untag_ptr(this_arg);
50434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50436         this_arg_conv.is_owned = false;
50437         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
50438         return ret_conv;
50439 }
50440
50441 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
50442         LDKInitFeatures this_arg_conv;
50443         this_arg_conv.inner = untag_ptr(this_arg);
50444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50446         this_arg_conv.is_owned = false;
50447         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
50448         return ret_conv;
50449 }
50450
50451 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
50452         LDKNodeFeatures this_arg_conv;
50453         this_arg_conv.inner = untag_ptr(this_arg);
50454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50456         this_arg_conv.is_owned = false;
50457         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
50458         return ret_conv;
50459 }
50460
50461 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
50462         LDKInitFeatures this_arg_conv;
50463         this_arg_conv.inner = untag_ptr(this_arg);
50464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50466         this_arg_conv.is_owned = false;
50467         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
50468 }
50469
50470 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
50471         LDKInitFeatures this_arg_conv;
50472         this_arg_conv.inner = untag_ptr(this_arg);
50473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50475         this_arg_conv.is_owned = false;
50476         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
50477 }
50478
50479 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
50480         LDKInitFeatures this_arg_conv;
50481         this_arg_conv.inner = untag_ptr(this_arg);
50482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50484         this_arg_conv.is_owned = false;
50485         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
50486         return ret_conv;
50487 }
50488
50489 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
50490         LDKInitFeatures this_arg_conv;
50491         this_arg_conv.inner = untag_ptr(this_arg);
50492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50494         this_arg_conv.is_owned = false;
50495         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
50496 }
50497
50498 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
50499         LDKInitFeatures this_arg_conv;
50500         this_arg_conv.inner = untag_ptr(this_arg);
50501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50503         this_arg_conv.is_owned = false;
50504         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
50505 }
50506
50507 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
50508         LDKInitFeatures this_arg_conv;
50509         this_arg_conv.inner = untag_ptr(this_arg);
50510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50512         this_arg_conv.is_owned = false;
50513         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
50514         return ret_conv;
50515 }
50516
50517 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
50518         LDKNodeFeatures this_arg_conv;
50519         this_arg_conv.inner = untag_ptr(this_arg);
50520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50522         this_arg_conv.is_owned = false;
50523         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
50524 }
50525
50526 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
50527         LDKNodeFeatures this_arg_conv;
50528         this_arg_conv.inner = untag_ptr(this_arg);
50529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50531         this_arg_conv.is_owned = false;
50532         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
50533 }
50534
50535 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
50536         LDKNodeFeatures this_arg_conv;
50537         this_arg_conv.inner = untag_ptr(this_arg);
50538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50540         this_arg_conv.is_owned = false;
50541         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
50542         return ret_conv;
50543 }
50544
50545 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
50546         LDKInitFeatures this_arg_conv;
50547         this_arg_conv.inner = untag_ptr(this_arg);
50548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50550         this_arg_conv.is_owned = false;
50551         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
50552         return ret_conv;
50553 }
50554
50555 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
50556         LDKNodeFeatures this_arg_conv;
50557         this_arg_conv.inner = untag_ptr(this_arg);
50558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50560         this_arg_conv.is_owned = false;
50561         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
50562         return ret_conv;
50563 }
50564
50565 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
50566         LDKInitFeatures this_arg_conv;
50567         this_arg_conv.inner = untag_ptr(this_arg);
50568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50570         this_arg_conv.is_owned = false;
50571         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
50572 }
50573
50574 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
50575         LDKInitFeatures this_arg_conv;
50576         this_arg_conv.inner = untag_ptr(this_arg);
50577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50579         this_arg_conv.is_owned = false;
50580         InitFeatures_set_gossip_queries_required(&this_arg_conv);
50581 }
50582
50583 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
50584         LDKInitFeatures this_arg_conv;
50585         this_arg_conv.inner = untag_ptr(this_arg);
50586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50588         this_arg_conv.is_owned = false;
50589         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
50590         return ret_conv;
50591 }
50592
50593 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
50594         LDKNodeFeatures this_arg_conv;
50595         this_arg_conv.inner = untag_ptr(this_arg);
50596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50598         this_arg_conv.is_owned = false;
50599         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
50600 }
50601
50602 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
50603         LDKNodeFeatures this_arg_conv;
50604         this_arg_conv.inner = untag_ptr(this_arg);
50605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50607         this_arg_conv.is_owned = false;
50608         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
50609 }
50610
50611 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
50612         LDKNodeFeatures this_arg_conv;
50613         this_arg_conv.inner = untag_ptr(this_arg);
50614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50616         this_arg_conv.is_owned = false;
50617         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
50618         return ret_conv;
50619 }
50620
50621 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
50622         LDKInitFeatures this_arg_conv;
50623         this_arg_conv.inner = untag_ptr(this_arg);
50624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50626         this_arg_conv.is_owned = false;
50627         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
50628         return ret_conv;
50629 }
50630
50631 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
50632         LDKNodeFeatures this_arg_conv;
50633         this_arg_conv.inner = untag_ptr(this_arg);
50634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50636         this_arg_conv.is_owned = false;
50637         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
50638         return ret_conv;
50639 }
50640
50641 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
50642         LDKInitFeatures this_arg_conv;
50643         this_arg_conv.inner = untag_ptr(this_arg);
50644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50646         this_arg_conv.is_owned = false;
50647         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
50648 }
50649
50650 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
50651         LDKInitFeatures this_arg_conv;
50652         this_arg_conv.inner = untag_ptr(this_arg);
50653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50655         this_arg_conv.is_owned = false;
50656         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
50657 }
50658
50659 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
50660         LDKInitFeatures this_arg_conv;
50661         this_arg_conv.inner = untag_ptr(this_arg);
50662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50664         this_arg_conv.is_owned = false;
50665         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
50666         return ret_conv;
50667 }
50668
50669 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
50670         LDKNodeFeatures this_arg_conv;
50671         this_arg_conv.inner = untag_ptr(this_arg);
50672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50674         this_arg_conv.is_owned = false;
50675         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
50676 }
50677
50678 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
50679         LDKNodeFeatures this_arg_conv;
50680         this_arg_conv.inner = untag_ptr(this_arg);
50681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50683         this_arg_conv.is_owned = false;
50684         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
50685 }
50686
50687 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
50688         LDKNodeFeatures this_arg_conv;
50689         this_arg_conv.inner = untag_ptr(this_arg);
50690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50692         this_arg_conv.is_owned = false;
50693         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
50694         return ret_conv;
50695 }
50696
50697 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
50698         LDKBolt11InvoiceFeatures this_arg_conv;
50699         this_arg_conv.inner = untag_ptr(this_arg);
50700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50702         this_arg_conv.is_owned = false;
50703         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
50704 }
50705
50706 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
50707         LDKBolt11InvoiceFeatures this_arg_conv;
50708         this_arg_conv.inner = untag_ptr(this_arg);
50709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50711         this_arg_conv.is_owned = false;
50712         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
50713 }
50714
50715 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
50716         LDKBolt11InvoiceFeatures this_arg_conv;
50717         this_arg_conv.inner = untag_ptr(this_arg);
50718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50720         this_arg_conv.is_owned = false;
50721         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
50722         return ret_conv;
50723 }
50724
50725 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
50726         LDKInitFeatures this_arg_conv;
50727         this_arg_conv.inner = untag_ptr(this_arg);
50728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50730         this_arg_conv.is_owned = false;
50731         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
50732         return ret_conv;
50733 }
50734
50735 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
50736         LDKNodeFeatures this_arg_conv;
50737         this_arg_conv.inner = untag_ptr(this_arg);
50738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50740         this_arg_conv.is_owned = false;
50741         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
50742         return ret_conv;
50743 }
50744
50745 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
50746         LDKBolt11InvoiceFeatures this_arg_conv;
50747         this_arg_conv.inner = untag_ptr(this_arg);
50748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50750         this_arg_conv.is_owned = false;
50751         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
50752         return ret_conv;
50753 }
50754
50755 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
50756         LDKInitFeatures this_arg_conv;
50757         this_arg_conv.inner = untag_ptr(this_arg);
50758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50760         this_arg_conv.is_owned = false;
50761         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
50762 }
50763
50764 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
50765         LDKInitFeatures this_arg_conv;
50766         this_arg_conv.inner = untag_ptr(this_arg);
50767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50769         this_arg_conv.is_owned = false;
50770         InitFeatures_set_static_remote_key_required(&this_arg_conv);
50771 }
50772
50773 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
50774         LDKInitFeatures this_arg_conv;
50775         this_arg_conv.inner = untag_ptr(this_arg);
50776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50778         this_arg_conv.is_owned = false;
50779         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
50780         return ret_conv;
50781 }
50782
50783 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
50784         LDKNodeFeatures this_arg_conv;
50785         this_arg_conv.inner = untag_ptr(this_arg);
50786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50788         this_arg_conv.is_owned = false;
50789         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
50790 }
50791
50792 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
50793         LDKNodeFeatures this_arg_conv;
50794         this_arg_conv.inner = untag_ptr(this_arg);
50795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50797         this_arg_conv.is_owned = false;
50798         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
50799 }
50800
50801 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
50802         LDKNodeFeatures this_arg_conv;
50803         this_arg_conv.inner = untag_ptr(this_arg);
50804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50806         this_arg_conv.is_owned = false;
50807         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
50808         return ret_conv;
50809 }
50810
50811 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
50812         LDKChannelTypeFeatures this_arg_conv;
50813         this_arg_conv.inner = untag_ptr(this_arg);
50814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50816         this_arg_conv.is_owned = false;
50817         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
50818 }
50819
50820 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
50821         LDKChannelTypeFeatures this_arg_conv;
50822         this_arg_conv.inner = untag_ptr(this_arg);
50823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50825         this_arg_conv.is_owned = false;
50826         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
50827 }
50828
50829 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
50830         LDKChannelTypeFeatures this_arg_conv;
50831         this_arg_conv.inner = untag_ptr(this_arg);
50832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50834         this_arg_conv.is_owned = false;
50835         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
50836         return ret_conv;
50837 }
50838
50839 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
50840         LDKInitFeatures this_arg_conv;
50841         this_arg_conv.inner = untag_ptr(this_arg);
50842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50844         this_arg_conv.is_owned = false;
50845         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
50846         return ret_conv;
50847 }
50848
50849 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
50850         LDKNodeFeatures this_arg_conv;
50851         this_arg_conv.inner = untag_ptr(this_arg);
50852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50854         this_arg_conv.is_owned = false;
50855         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
50856         return ret_conv;
50857 }
50858
50859 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
50860         LDKChannelTypeFeatures this_arg_conv;
50861         this_arg_conv.inner = untag_ptr(this_arg);
50862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50864         this_arg_conv.is_owned = false;
50865         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
50866         return ret_conv;
50867 }
50868
50869 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
50870         LDKInitFeatures this_arg_conv;
50871         this_arg_conv.inner = untag_ptr(this_arg);
50872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50874         this_arg_conv.is_owned = false;
50875         InitFeatures_set_payment_secret_optional(&this_arg_conv);
50876 }
50877
50878 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
50879         LDKInitFeatures 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         InitFeatures_set_payment_secret_required(&this_arg_conv);
50885 }
50886
50887 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
50888         LDKInitFeatures this_arg_conv;
50889         this_arg_conv.inner = untag_ptr(this_arg);
50890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50892         this_arg_conv.is_owned = false;
50893         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
50894         return ret_conv;
50895 }
50896
50897 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
50898         LDKNodeFeatures this_arg_conv;
50899         this_arg_conv.inner = untag_ptr(this_arg);
50900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50902         this_arg_conv.is_owned = false;
50903         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
50904 }
50905
50906 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
50907         LDKNodeFeatures this_arg_conv;
50908         this_arg_conv.inner = untag_ptr(this_arg);
50909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50911         this_arg_conv.is_owned = false;
50912         NodeFeatures_set_payment_secret_required(&this_arg_conv);
50913 }
50914
50915 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
50916         LDKNodeFeatures this_arg_conv;
50917         this_arg_conv.inner = untag_ptr(this_arg);
50918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50920         this_arg_conv.is_owned = false;
50921         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
50922         return ret_conv;
50923 }
50924
50925 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
50926         LDKBolt11InvoiceFeatures this_arg_conv;
50927         this_arg_conv.inner = untag_ptr(this_arg);
50928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50930         this_arg_conv.is_owned = false;
50931         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
50932 }
50933
50934 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
50935         LDKBolt11InvoiceFeatures this_arg_conv;
50936         this_arg_conv.inner = untag_ptr(this_arg);
50937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50939         this_arg_conv.is_owned = false;
50940         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
50941 }
50942
50943 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
50944         LDKBolt11InvoiceFeatures this_arg_conv;
50945         this_arg_conv.inner = untag_ptr(this_arg);
50946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50948         this_arg_conv.is_owned = false;
50949         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
50950         return ret_conv;
50951 }
50952
50953 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
50954         LDKInitFeatures this_arg_conv;
50955         this_arg_conv.inner = untag_ptr(this_arg);
50956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50958         this_arg_conv.is_owned = false;
50959         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
50960         return ret_conv;
50961 }
50962
50963 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
50964         LDKNodeFeatures this_arg_conv;
50965         this_arg_conv.inner = untag_ptr(this_arg);
50966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50968         this_arg_conv.is_owned = false;
50969         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
50970         return ret_conv;
50971 }
50972
50973 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
50974         LDKBolt11InvoiceFeatures this_arg_conv;
50975         this_arg_conv.inner = untag_ptr(this_arg);
50976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50978         this_arg_conv.is_owned = false;
50979         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
50980         return ret_conv;
50981 }
50982
50983 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
50984         LDKInitFeatures this_arg_conv;
50985         this_arg_conv.inner = untag_ptr(this_arg);
50986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50988         this_arg_conv.is_owned = false;
50989         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
50990 }
50991
50992 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
50993         LDKInitFeatures this_arg_conv;
50994         this_arg_conv.inner = untag_ptr(this_arg);
50995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50997         this_arg_conv.is_owned = false;
50998         InitFeatures_set_basic_mpp_required(&this_arg_conv);
50999 }
51000
51001 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
51002         LDKInitFeatures this_arg_conv;
51003         this_arg_conv.inner = untag_ptr(this_arg);
51004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51006         this_arg_conv.is_owned = false;
51007         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
51008         return ret_conv;
51009 }
51010
51011 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51012         LDKNodeFeatures this_arg_conv;
51013         this_arg_conv.inner = untag_ptr(this_arg);
51014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51016         this_arg_conv.is_owned = false;
51017         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
51018 }
51019
51020 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
51021         LDKNodeFeatures this_arg_conv;
51022         this_arg_conv.inner = untag_ptr(this_arg);
51023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51025         this_arg_conv.is_owned = false;
51026         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
51027 }
51028
51029 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
51030         LDKNodeFeatures this_arg_conv;
51031         this_arg_conv.inner = untag_ptr(this_arg);
51032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51034         this_arg_conv.is_owned = false;
51035         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
51036         return ret_conv;
51037 }
51038
51039 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51040         LDKBolt11InvoiceFeatures this_arg_conv;
51041         this_arg_conv.inner = untag_ptr(this_arg);
51042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51044         this_arg_conv.is_owned = false;
51045         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
51046 }
51047
51048 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
51049         LDKBolt11InvoiceFeatures this_arg_conv;
51050         this_arg_conv.inner = untag_ptr(this_arg);
51051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51053         this_arg_conv.is_owned = false;
51054         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
51055 }
51056
51057 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
51058         LDKBolt11InvoiceFeatures this_arg_conv;
51059         this_arg_conv.inner = untag_ptr(this_arg);
51060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51062         this_arg_conv.is_owned = false;
51063         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
51064         return ret_conv;
51065 }
51066
51067 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51068         LDKBolt12InvoiceFeatures this_arg_conv;
51069         this_arg_conv.inner = untag_ptr(this_arg);
51070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51072         this_arg_conv.is_owned = false;
51073         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
51074 }
51075
51076 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
51077         LDKBolt12InvoiceFeatures this_arg_conv;
51078         this_arg_conv.inner = untag_ptr(this_arg);
51079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51081         this_arg_conv.is_owned = false;
51082         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
51083 }
51084
51085 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
51086         LDKBolt12InvoiceFeatures this_arg_conv;
51087         this_arg_conv.inner = untag_ptr(this_arg);
51088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51090         this_arg_conv.is_owned = false;
51091         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
51092         return ret_conv;
51093 }
51094
51095 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
51096         LDKInitFeatures this_arg_conv;
51097         this_arg_conv.inner = untag_ptr(this_arg);
51098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51100         this_arg_conv.is_owned = false;
51101         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
51102         return ret_conv;
51103 }
51104
51105 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
51106         LDKNodeFeatures this_arg_conv;
51107         this_arg_conv.inner = untag_ptr(this_arg);
51108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51110         this_arg_conv.is_owned = false;
51111         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
51112         return ret_conv;
51113 }
51114
51115 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
51116         LDKBolt11InvoiceFeatures this_arg_conv;
51117         this_arg_conv.inner = untag_ptr(this_arg);
51118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51120         this_arg_conv.is_owned = false;
51121         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
51122         return ret_conv;
51123 }
51124
51125 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
51126         LDKBolt12InvoiceFeatures this_arg_conv;
51127         this_arg_conv.inner = untag_ptr(this_arg);
51128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51130         this_arg_conv.is_owned = false;
51131         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
51132         return ret_conv;
51133 }
51134
51135 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
51136         LDKInitFeatures this_arg_conv;
51137         this_arg_conv.inner = untag_ptr(this_arg);
51138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51140         this_arg_conv.is_owned = false;
51141         InitFeatures_set_wumbo_optional(&this_arg_conv);
51142 }
51143
51144 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
51145         LDKInitFeatures this_arg_conv;
51146         this_arg_conv.inner = untag_ptr(this_arg);
51147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51149         this_arg_conv.is_owned = false;
51150         InitFeatures_set_wumbo_required(&this_arg_conv);
51151 }
51152
51153 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
51154         LDKInitFeatures this_arg_conv;
51155         this_arg_conv.inner = untag_ptr(this_arg);
51156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51158         this_arg_conv.is_owned = false;
51159         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
51160         return ret_conv;
51161 }
51162
51163 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
51164         LDKNodeFeatures this_arg_conv;
51165         this_arg_conv.inner = untag_ptr(this_arg);
51166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51168         this_arg_conv.is_owned = false;
51169         NodeFeatures_set_wumbo_optional(&this_arg_conv);
51170 }
51171
51172 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
51173         LDKNodeFeatures this_arg_conv;
51174         this_arg_conv.inner = untag_ptr(this_arg);
51175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51177         this_arg_conv.is_owned = false;
51178         NodeFeatures_set_wumbo_required(&this_arg_conv);
51179 }
51180
51181 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
51182         LDKNodeFeatures this_arg_conv;
51183         this_arg_conv.inner = untag_ptr(this_arg);
51184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51186         this_arg_conv.is_owned = false;
51187         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
51188         return ret_conv;
51189 }
51190
51191 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
51192         LDKInitFeatures this_arg_conv;
51193         this_arg_conv.inner = untag_ptr(this_arg);
51194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51196         this_arg_conv.is_owned = false;
51197         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
51198         return ret_conv;
51199 }
51200
51201 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
51202         LDKNodeFeatures this_arg_conv;
51203         this_arg_conv.inner = untag_ptr(this_arg);
51204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51206         this_arg_conv.is_owned = false;
51207         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
51208         return ret_conv;
51209 }
51210
51211 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) {
51212         LDKInitFeatures this_arg_conv;
51213         this_arg_conv.inner = untag_ptr(this_arg);
51214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51216         this_arg_conv.is_owned = false;
51217         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51218 }
51219
51220 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) {
51221         LDKInitFeatures this_arg_conv;
51222         this_arg_conv.inner = untag_ptr(this_arg);
51223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51225         this_arg_conv.is_owned = false;
51226         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51227 }
51228
51229 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51230         LDKInitFeatures this_arg_conv;
51231         this_arg_conv.inner = untag_ptr(this_arg);
51232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51234         this_arg_conv.is_owned = false;
51235         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51236         return ret_conv;
51237 }
51238
51239 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) {
51240         LDKNodeFeatures this_arg_conv;
51241         this_arg_conv.inner = untag_ptr(this_arg);
51242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51244         this_arg_conv.is_owned = false;
51245         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51246 }
51247
51248 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) {
51249         LDKNodeFeatures this_arg_conv;
51250         this_arg_conv.inner = untag_ptr(this_arg);
51251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51253         this_arg_conv.is_owned = false;
51254         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51255 }
51256
51257 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51258         LDKNodeFeatures this_arg_conv;
51259         this_arg_conv.inner = untag_ptr(this_arg);
51260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51262         this_arg_conv.is_owned = false;
51263         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51264         return ret_conv;
51265 }
51266
51267 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) {
51268         LDKChannelTypeFeatures this_arg_conv;
51269         this_arg_conv.inner = untag_ptr(this_arg);
51270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51272         this_arg_conv.is_owned = false;
51273         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51274 }
51275
51276 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) {
51277         LDKChannelTypeFeatures this_arg_conv;
51278         this_arg_conv.inner = untag_ptr(this_arg);
51279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51281         this_arg_conv.is_owned = false;
51282         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51283 }
51284
51285 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51286         LDKChannelTypeFeatures this_arg_conv;
51287         this_arg_conv.inner = untag_ptr(this_arg);
51288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51290         this_arg_conv.is_owned = false;
51291         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51292         return ret_conv;
51293 }
51294
51295 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51296         LDKInitFeatures this_arg_conv;
51297         this_arg_conv.inner = untag_ptr(this_arg);
51298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51300         this_arg_conv.is_owned = false;
51301         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51302         return ret_conv;
51303 }
51304
51305 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51306         LDKNodeFeatures this_arg_conv;
51307         this_arg_conv.inner = untag_ptr(this_arg);
51308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51310         this_arg_conv.is_owned = false;
51311         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51312         return ret_conv;
51313 }
51314
51315 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51316         LDKChannelTypeFeatures this_arg_conv;
51317         this_arg_conv.inner = untag_ptr(this_arg);
51318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51320         this_arg_conv.is_owned = false;
51321         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51322         return ret_conv;
51323 }
51324
51325 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) {
51326         LDKInitFeatures this_arg_conv;
51327         this_arg_conv.inner = untag_ptr(this_arg);
51328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51330         this_arg_conv.is_owned = false;
51331         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51332 }
51333
51334 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) {
51335         LDKInitFeatures this_arg_conv;
51336         this_arg_conv.inner = untag_ptr(this_arg);
51337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51339         this_arg_conv.is_owned = false;
51340         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51341 }
51342
51343 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51344         LDKInitFeatures this_arg_conv;
51345         this_arg_conv.inner = untag_ptr(this_arg);
51346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51348         this_arg_conv.is_owned = false;
51349         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51350         return ret_conv;
51351 }
51352
51353 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) {
51354         LDKNodeFeatures this_arg_conv;
51355         this_arg_conv.inner = untag_ptr(this_arg);
51356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51358         this_arg_conv.is_owned = false;
51359         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51360 }
51361
51362 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) {
51363         LDKNodeFeatures this_arg_conv;
51364         this_arg_conv.inner = untag_ptr(this_arg);
51365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51367         this_arg_conv.is_owned = false;
51368         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51369 }
51370
51371 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51372         LDKNodeFeatures this_arg_conv;
51373         this_arg_conv.inner = untag_ptr(this_arg);
51374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51376         this_arg_conv.is_owned = false;
51377         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51378         return ret_conv;
51379 }
51380
51381 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) {
51382         LDKChannelTypeFeatures this_arg_conv;
51383         this_arg_conv.inner = untag_ptr(this_arg);
51384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51386         this_arg_conv.is_owned = false;
51387         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51388 }
51389
51390 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) {
51391         LDKChannelTypeFeatures this_arg_conv;
51392         this_arg_conv.inner = untag_ptr(this_arg);
51393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51395         this_arg_conv.is_owned = false;
51396         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51397 }
51398
51399 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51400         LDKChannelTypeFeatures this_arg_conv;
51401         this_arg_conv.inner = untag_ptr(this_arg);
51402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51404         this_arg_conv.is_owned = false;
51405         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51406         return ret_conv;
51407 }
51408
51409 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51410         LDKInitFeatures this_arg_conv;
51411         this_arg_conv.inner = untag_ptr(this_arg);
51412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51414         this_arg_conv.is_owned = false;
51415         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
51416         return ret_conv;
51417 }
51418
51419 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51420         LDKNodeFeatures this_arg_conv;
51421         this_arg_conv.inner = untag_ptr(this_arg);
51422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51424         this_arg_conv.is_owned = false;
51425         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
51426         return ret_conv;
51427 }
51428
51429 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51430         LDKChannelTypeFeatures this_arg_conv;
51431         this_arg_conv.inner = untag_ptr(this_arg);
51432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51434         this_arg_conv.is_owned = false;
51435         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
51436         return ret_conv;
51437 }
51438
51439 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
51440         LDKInitFeatures this_arg_conv;
51441         this_arg_conv.inner = untag_ptr(this_arg);
51442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51444         this_arg_conv.is_owned = false;
51445         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
51446 }
51447
51448 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
51449         LDKInitFeatures this_arg_conv;
51450         this_arg_conv.inner = untag_ptr(this_arg);
51451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51453         this_arg_conv.is_owned = false;
51454         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
51455 }
51456
51457 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
51458         LDKInitFeatures this_arg_conv;
51459         this_arg_conv.inner = untag_ptr(this_arg);
51460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51462         this_arg_conv.is_owned = false;
51463         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
51464         return ret_conv;
51465 }
51466
51467 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
51468         LDKNodeFeatures this_arg_conv;
51469         this_arg_conv.inner = untag_ptr(this_arg);
51470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51472         this_arg_conv.is_owned = false;
51473         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
51474 }
51475
51476 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
51477         LDKNodeFeatures this_arg_conv;
51478         this_arg_conv.inner = untag_ptr(this_arg);
51479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51481         this_arg_conv.is_owned = false;
51482         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
51483 }
51484
51485 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
51486         LDKNodeFeatures this_arg_conv;
51487         this_arg_conv.inner = untag_ptr(this_arg);
51488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51490         this_arg_conv.is_owned = false;
51491         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
51492         return ret_conv;
51493 }
51494
51495 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
51496         LDKInitFeatures this_arg_conv;
51497         this_arg_conv.inner = untag_ptr(this_arg);
51498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51500         this_arg_conv.is_owned = false;
51501         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
51502         return ret_conv;
51503 }
51504
51505 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
51506         LDKNodeFeatures this_arg_conv;
51507         this_arg_conv.inner = untag_ptr(this_arg);
51508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51510         this_arg_conv.is_owned = false;
51511         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
51512         return ret_conv;
51513 }
51514
51515 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
51516         LDKInitFeatures this_arg_conv;
51517         this_arg_conv.inner = untag_ptr(this_arg);
51518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51520         this_arg_conv.is_owned = false;
51521         InitFeatures_set_taproot_optional(&this_arg_conv);
51522 }
51523
51524 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
51525         LDKInitFeatures 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         InitFeatures_set_taproot_required(&this_arg_conv);
51531 }
51532
51533 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
51534         LDKInitFeatures this_arg_conv;
51535         this_arg_conv.inner = untag_ptr(this_arg);
51536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51538         this_arg_conv.is_owned = false;
51539         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
51540         return ret_conv;
51541 }
51542
51543 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
51544         LDKNodeFeatures this_arg_conv;
51545         this_arg_conv.inner = untag_ptr(this_arg);
51546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51548         this_arg_conv.is_owned = false;
51549         NodeFeatures_set_taproot_optional(&this_arg_conv);
51550 }
51551
51552 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
51553         LDKNodeFeatures this_arg_conv;
51554         this_arg_conv.inner = untag_ptr(this_arg);
51555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51557         this_arg_conv.is_owned = false;
51558         NodeFeatures_set_taproot_required(&this_arg_conv);
51559 }
51560
51561 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
51562         LDKNodeFeatures this_arg_conv;
51563         this_arg_conv.inner = untag_ptr(this_arg);
51564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51566         this_arg_conv.is_owned = false;
51567         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
51568         return ret_conv;
51569 }
51570
51571 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
51572         LDKChannelTypeFeatures this_arg_conv;
51573         this_arg_conv.inner = untag_ptr(this_arg);
51574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51576         this_arg_conv.is_owned = false;
51577         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
51578 }
51579
51580 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
51581         LDKChannelTypeFeatures this_arg_conv;
51582         this_arg_conv.inner = untag_ptr(this_arg);
51583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51585         this_arg_conv.is_owned = false;
51586         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
51587 }
51588
51589 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
51590         LDKChannelTypeFeatures this_arg_conv;
51591         this_arg_conv.inner = untag_ptr(this_arg);
51592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51594         this_arg_conv.is_owned = false;
51595         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
51596         return ret_conv;
51597 }
51598
51599 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
51600         LDKInitFeatures this_arg_conv;
51601         this_arg_conv.inner = untag_ptr(this_arg);
51602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51604         this_arg_conv.is_owned = false;
51605         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
51606         return ret_conv;
51607 }
51608
51609 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
51610         LDKNodeFeatures this_arg_conv;
51611         this_arg_conv.inner = untag_ptr(this_arg);
51612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51614         this_arg_conv.is_owned = false;
51615         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
51616         return ret_conv;
51617 }
51618
51619 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
51620         LDKChannelTypeFeatures this_arg_conv;
51621         this_arg_conv.inner = untag_ptr(this_arg);
51622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51624         this_arg_conv.is_owned = false;
51625         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
51626         return ret_conv;
51627 }
51628
51629 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
51630         LDKInitFeatures this_arg_conv;
51631         this_arg_conv.inner = untag_ptr(this_arg);
51632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51634         this_arg_conv.is_owned = false;
51635         InitFeatures_set_onion_messages_optional(&this_arg_conv);
51636 }
51637
51638 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
51639         LDKInitFeatures this_arg_conv;
51640         this_arg_conv.inner = untag_ptr(this_arg);
51641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51643         this_arg_conv.is_owned = false;
51644         InitFeatures_set_onion_messages_required(&this_arg_conv);
51645 }
51646
51647 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
51648         LDKInitFeatures this_arg_conv;
51649         this_arg_conv.inner = untag_ptr(this_arg);
51650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51652         this_arg_conv.is_owned = false;
51653         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
51654         return ret_conv;
51655 }
51656
51657 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
51658         LDKNodeFeatures this_arg_conv;
51659         this_arg_conv.inner = untag_ptr(this_arg);
51660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51662         this_arg_conv.is_owned = false;
51663         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
51664 }
51665
51666 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
51667         LDKNodeFeatures this_arg_conv;
51668         this_arg_conv.inner = untag_ptr(this_arg);
51669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51671         this_arg_conv.is_owned = false;
51672         NodeFeatures_set_onion_messages_required(&this_arg_conv);
51673 }
51674
51675 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
51676         LDKNodeFeatures this_arg_conv;
51677         this_arg_conv.inner = untag_ptr(this_arg);
51678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51680         this_arg_conv.is_owned = false;
51681         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
51682         return ret_conv;
51683 }
51684
51685 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
51686         LDKInitFeatures this_arg_conv;
51687         this_arg_conv.inner = untag_ptr(this_arg);
51688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51690         this_arg_conv.is_owned = false;
51691         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
51692         return ret_conv;
51693 }
51694
51695 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
51696         LDKNodeFeatures this_arg_conv;
51697         this_arg_conv.inner = untag_ptr(this_arg);
51698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51700         this_arg_conv.is_owned = false;
51701         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
51702         return ret_conv;
51703 }
51704
51705 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
51706         LDKInitFeatures this_arg_conv;
51707         this_arg_conv.inner = untag_ptr(this_arg);
51708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51710         this_arg_conv.is_owned = false;
51711         InitFeatures_set_channel_type_optional(&this_arg_conv);
51712 }
51713
51714 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
51715         LDKInitFeatures this_arg_conv;
51716         this_arg_conv.inner = untag_ptr(this_arg);
51717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51719         this_arg_conv.is_owned = false;
51720         InitFeatures_set_channel_type_required(&this_arg_conv);
51721 }
51722
51723 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
51724         LDKInitFeatures this_arg_conv;
51725         this_arg_conv.inner = untag_ptr(this_arg);
51726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51728         this_arg_conv.is_owned = false;
51729         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
51730         return ret_conv;
51731 }
51732
51733 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
51734         LDKNodeFeatures this_arg_conv;
51735         this_arg_conv.inner = untag_ptr(this_arg);
51736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51738         this_arg_conv.is_owned = false;
51739         NodeFeatures_set_channel_type_optional(&this_arg_conv);
51740 }
51741
51742 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
51743         LDKNodeFeatures this_arg_conv;
51744         this_arg_conv.inner = untag_ptr(this_arg);
51745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51747         this_arg_conv.is_owned = false;
51748         NodeFeatures_set_channel_type_required(&this_arg_conv);
51749 }
51750
51751 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
51752         LDKNodeFeatures this_arg_conv;
51753         this_arg_conv.inner = untag_ptr(this_arg);
51754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51756         this_arg_conv.is_owned = false;
51757         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
51758         return ret_conv;
51759 }
51760
51761 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
51762         LDKInitFeatures this_arg_conv;
51763         this_arg_conv.inner = untag_ptr(this_arg);
51764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51766         this_arg_conv.is_owned = false;
51767         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
51768         return ret_conv;
51769 }
51770
51771 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
51772         LDKNodeFeatures this_arg_conv;
51773         this_arg_conv.inner = untag_ptr(this_arg);
51774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51776         this_arg_conv.is_owned = false;
51777         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
51778         return ret_conv;
51779 }
51780
51781 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
51782         LDKInitFeatures this_arg_conv;
51783         this_arg_conv.inner = untag_ptr(this_arg);
51784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51786         this_arg_conv.is_owned = false;
51787         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
51788 }
51789
51790 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
51791         LDKInitFeatures this_arg_conv;
51792         this_arg_conv.inner = untag_ptr(this_arg);
51793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51795         this_arg_conv.is_owned = false;
51796         InitFeatures_set_scid_privacy_required(&this_arg_conv);
51797 }
51798
51799 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
51800         LDKInitFeatures this_arg_conv;
51801         this_arg_conv.inner = untag_ptr(this_arg);
51802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51804         this_arg_conv.is_owned = false;
51805         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
51806         return ret_conv;
51807 }
51808
51809 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
51810         LDKNodeFeatures this_arg_conv;
51811         this_arg_conv.inner = untag_ptr(this_arg);
51812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51814         this_arg_conv.is_owned = false;
51815         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
51816 }
51817
51818 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
51819         LDKNodeFeatures this_arg_conv;
51820         this_arg_conv.inner = untag_ptr(this_arg);
51821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51823         this_arg_conv.is_owned = false;
51824         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
51825 }
51826
51827 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
51828         LDKNodeFeatures this_arg_conv;
51829         this_arg_conv.inner = untag_ptr(this_arg);
51830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51832         this_arg_conv.is_owned = false;
51833         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
51834         return ret_conv;
51835 }
51836
51837 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
51838         LDKChannelTypeFeatures 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         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
51844 }
51845
51846 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
51847         LDKChannelTypeFeatures this_arg_conv;
51848         this_arg_conv.inner = untag_ptr(this_arg);
51849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51851         this_arg_conv.is_owned = false;
51852         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
51853 }
51854
51855 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
51856         LDKChannelTypeFeatures this_arg_conv;
51857         this_arg_conv.inner = untag_ptr(this_arg);
51858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51860         this_arg_conv.is_owned = false;
51861         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
51862         return ret_conv;
51863 }
51864
51865 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
51866         LDKInitFeatures this_arg_conv;
51867         this_arg_conv.inner = untag_ptr(this_arg);
51868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51870         this_arg_conv.is_owned = false;
51871         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
51872         return ret_conv;
51873 }
51874
51875 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
51876         LDKNodeFeatures this_arg_conv;
51877         this_arg_conv.inner = untag_ptr(this_arg);
51878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51880         this_arg_conv.is_owned = false;
51881         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
51882         return ret_conv;
51883 }
51884
51885 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
51886         LDKChannelTypeFeatures this_arg_conv;
51887         this_arg_conv.inner = untag_ptr(this_arg);
51888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51890         this_arg_conv.is_owned = false;
51891         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
51892         return ret_conv;
51893 }
51894
51895 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
51896         LDKBolt11InvoiceFeatures this_arg_conv;
51897         this_arg_conv.inner = untag_ptr(this_arg);
51898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51900         this_arg_conv.is_owned = false;
51901         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
51902 }
51903
51904 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
51905         LDKBolt11InvoiceFeatures this_arg_conv;
51906         this_arg_conv.inner = untag_ptr(this_arg);
51907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51909         this_arg_conv.is_owned = false;
51910         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
51911 }
51912
51913 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
51914         LDKBolt11InvoiceFeatures this_arg_conv;
51915         this_arg_conv.inner = untag_ptr(this_arg);
51916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51918         this_arg_conv.is_owned = false;
51919         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
51920         return ret_conv;
51921 }
51922
51923 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
51924         LDKBolt11InvoiceFeatures this_arg_conv;
51925         this_arg_conv.inner = untag_ptr(this_arg);
51926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51928         this_arg_conv.is_owned = false;
51929         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
51930         return ret_conv;
51931 }
51932
51933 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
51934         LDKInitFeatures this_arg_conv;
51935         this_arg_conv.inner = untag_ptr(this_arg);
51936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51938         this_arg_conv.is_owned = false;
51939         InitFeatures_set_zero_conf_optional(&this_arg_conv);
51940 }
51941
51942 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
51943         LDKInitFeatures this_arg_conv;
51944         this_arg_conv.inner = untag_ptr(this_arg);
51945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51947         this_arg_conv.is_owned = false;
51948         InitFeatures_set_zero_conf_required(&this_arg_conv);
51949 }
51950
51951 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
51952         LDKInitFeatures this_arg_conv;
51953         this_arg_conv.inner = untag_ptr(this_arg);
51954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51956         this_arg_conv.is_owned = false;
51957         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
51958         return ret_conv;
51959 }
51960
51961 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
51962         LDKNodeFeatures this_arg_conv;
51963         this_arg_conv.inner = untag_ptr(this_arg);
51964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51966         this_arg_conv.is_owned = false;
51967         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
51968 }
51969
51970 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
51971         LDKNodeFeatures this_arg_conv;
51972         this_arg_conv.inner = untag_ptr(this_arg);
51973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51975         this_arg_conv.is_owned = false;
51976         NodeFeatures_set_zero_conf_required(&this_arg_conv);
51977 }
51978
51979 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
51980         LDKNodeFeatures this_arg_conv;
51981         this_arg_conv.inner = untag_ptr(this_arg);
51982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51984         this_arg_conv.is_owned = false;
51985         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
51986         return ret_conv;
51987 }
51988
51989 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
51990         LDKChannelTypeFeatures this_arg_conv;
51991         this_arg_conv.inner = untag_ptr(this_arg);
51992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51994         this_arg_conv.is_owned = false;
51995         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
51996 }
51997
51998 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
51999         LDKChannelTypeFeatures this_arg_conv;
52000         this_arg_conv.inner = untag_ptr(this_arg);
52001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52003         this_arg_conv.is_owned = false;
52004         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
52005 }
52006
52007 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
52008         LDKChannelTypeFeatures this_arg_conv;
52009         this_arg_conv.inner = untag_ptr(this_arg);
52010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52012         this_arg_conv.is_owned = false;
52013         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
52014         return ret_conv;
52015 }
52016
52017 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
52018         LDKInitFeatures this_arg_conv;
52019         this_arg_conv.inner = untag_ptr(this_arg);
52020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52022         this_arg_conv.is_owned = false;
52023         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
52024         return ret_conv;
52025 }
52026
52027 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
52028         LDKNodeFeatures this_arg_conv;
52029         this_arg_conv.inner = untag_ptr(this_arg);
52030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52032         this_arg_conv.is_owned = false;
52033         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
52034         return ret_conv;
52035 }
52036
52037 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
52038         LDKChannelTypeFeatures this_arg_conv;
52039         this_arg_conv.inner = untag_ptr(this_arg);
52040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52042         this_arg_conv.is_owned = false;
52043         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
52044         return ret_conv;
52045 }
52046
52047 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
52048         LDKNodeFeatures this_arg_conv;
52049         this_arg_conv.inner = untag_ptr(this_arg);
52050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52052         this_arg_conv.is_owned = false;
52053         NodeFeatures_set_keysend_optional(&this_arg_conv);
52054 }
52055
52056 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
52057         LDKNodeFeatures this_arg_conv;
52058         this_arg_conv.inner = untag_ptr(this_arg);
52059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52061         this_arg_conv.is_owned = false;
52062         NodeFeatures_set_keysend_required(&this_arg_conv);
52063 }
52064
52065 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
52066         LDKNodeFeatures this_arg_conv;
52067         this_arg_conv.inner = untag_ptr(this_arg);
52068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52070         this_arg_conv.is_owned = false;
52071         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
52072         return ret_conv;
52073 }
52074
52075 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
52076         LDKNodeFeatures this_arg_conv;
52077         this_arg_conv.inner = untag_ptr(this_arg);
52078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52080         this_arg_conv.is_owned = false;
52081         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
52082         return ret_conv;
52083 }
52084
52085 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
52086         LDKShutdownScript this_obj_conv;
52087         this_obj_conv.inner = untag_ptr(this_obj);
52088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52090         ShutdownScript_free(this_obj_conv);
52091 }
52092
52093 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
52094         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
52095         uint64_t ret_ref = 0;
52096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52098         return ret_ref;
52099 }
52100 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
52101         LDKShutdownScript arg_conv;
52102         arg_conv.inner = untag_ptr(arg);
52103         arg_conv.is_owned = ptr_is_owned(arg);
52104         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52105         arg_conv.is_owned = false;
52106         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
52107         return ret_conv;
52108 }
52109
52110 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
52111         LDKShutdownScript orig_conv;
52112         orig_conv.inner = untag_ptr(orig);
52113         orig_conv.is_owned = ptr_is_owned(orig);
52114         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52115         orig_conv.is_owned = false;
52116         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
52117         uint64_t ret_ref = 0;
52118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52120         return ret_ref;
52121 }
52122
52123 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
52124         LDKShutdownScript a_conv;
52125         a_conv.inner = untag_ptr(a);
52126         a_conv.is_owned = ptr_is_owned(a);
52127         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52128         a_conv.is_owned = false;
52129         LDKShutdownScript b_conv;
52130         b_conv.inner = untag_ptr(b);
52131         b_conv.is_owned = ptr_is_owned(b);
52132         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52133         b_conv.is_owned = false;
52134         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
52135         return ret_conv;
52136 }
52137
52138 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
52139         LDKInvalidShutdownScript this_obj_conv;
52140         this_obj_conv.inner = untag_ptr(this_obj);
52141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52143         InvalidShutdownScript_free(this_obj_conv);
52144 }
52145
52146 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
52147         LDKInvalidShutdownScript this_ptr_conv;
52148         this_ptr_conv.inner = untag_ptr(this_ptr);
52149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52151         this_ptr_conv.is_owned = false;
52152         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
52153         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52154         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52155         return ret_arr;
52156 }
52157
52158 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
52159         LDKInvalidShutdownScript this_ptr_conv;
52160         this_ptr_conv.inner = untag_ptr(this_ptr);
52161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52163         this_ptr_conv.is_owned = false;
52164         LDKCVec_u8Z val_ref;
52165         val_ref.datalen = val->arr_len;
52166         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52167         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52168         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
52169 }
52170
52171 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
52172         LDKCVec_u8Z script_arg_ref;
52173         script_arg_ref.datalen = script_arg->arr_len;
52174         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52175         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
52176         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
52177         uint64_t ret_ref = 0;
52178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52180         return ret_ref;
52181 }
52182
52183 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
52184         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
52185         uint64_t ret_ref = 0;
52186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52188         return ret_ref;
52189 }
52190 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
52191         LDKInvalidShutdownScript arg_conv;
52192         arg_conv.inner = untag_ptr(arg);
52193         arg_conv.is_owned = ptr_is_owned(arg);
52194         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52195         arg_conv.is_owned = false;
52196         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
52197         return ret_conv;
52198 }
52199
52200 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
52201         LDKInvalidShutdownScript orig_conv;
52202         orig_conv.inner = untag_ptr(orig);
52203         orig_conv.is_owned = ptr_is_owned(orig);
52204         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52205         orig_conv.is_owned = false;
52206         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
52207         uint64_t ret_ref = 0;
52208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52210         return ret_ref;
52211 }
52212
52213 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
52214         LDKShutdownScript obj_conv;
52215         obj_conv.inner = untag_ptr(obj);
52216         obj_conv.is_owned = ptr_is_owned(obj);
52217         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52218         obj_conv.is_owned = false;
52219         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
52220         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52221         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52222         CVec_u8Z_free(ret_var);
52223         return ret_arr;
52224 }
52225
52226 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
52227         LDKu8slice ser_ref;
52228         ser_ref.datalen = ser->arr_len;
52229         ser_ref.data = ser->elems;
52230         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
52231         *ret_conv = ShutdownScript_read(ser_ref);
52232         FREE(ser);
52233         return tag_ptr(ret_conv, true);
52234 }
52235
52236 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
52237         uint8_t pubkey_hash_arr[20];
52238         CHECK(pubkey_hash->arr_len == 20);
52239         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
52240         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
52241         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
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 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
52249         uint8_t script_hash_arr[32];
52250         CHECK(script_hash->arr_len == 32);
52251         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
52252         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
52253         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
52254         uint64_t ret_ref = 0;
52255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52257         return ret_ref;
52258 }
52259
52260 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
52261         
52262         LDKu8slice program_ref;
52263         program_ref.datalen = program->arr_len;
52264         program_ref.data = program->elems;
52265         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
52266         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
52267         FREE(program);
52268         return tag_ptr(ret_conv, true);
52269 }
52270
52271 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
52272         LDKShutdownScript this_arg_conv;
52273         this_arg_conv.inner = untag_ptr(this_arg);
52274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52276         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
52277         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
52278         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52279         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52280         CVec_u8Z_free(ret_var);
52281         return ret_arr;
52282 }
52283
52284 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
52285         LDKShutdownScript this_arg_conv;
52286         this_arg_conv.inner = untag_ptr(this_arg);
52287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52289         this_arg_conv.is_owned = false;
52290         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52291         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
52292         return ret_arr;
52293 }
52294
52295 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
52296         LDKShutdownScript this_arg_conv;
52297         this_arg_conv.inner = untag_ptr(this_arg);
52298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52300         this_arg_conv.is_owned = false;
52301         LDKInitFeatures features_conv;
52302         features_conv.inner = untag_ptr(features);
52303         features_conv.is_owned = ptr_is_owned(features);
52304         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
52305         features_conv.is_owned = false;
52306         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
52307         return ret_conv;
52308 }
52309
52310 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
52311         if (!ptr_is_owned(this_ptr)) return;
52312         void* this_ptr_ptr = untag_ptr(this_ptr);
52313         CHECK_ACCESS(this_ptr_ptr);
52314         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
52315         FREE(untag_ptr(this_ptr));
52316         Retry_free(this_ptr_conv);
52317 }
52318
52319 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
52320         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52321         *ret_copy = Retry_clone(arg);
52322         uint64_t ret_ref = tag_ptr(ret_copy, true);
52323         return ret_ref;
52324 }
52325 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
52326         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
52327         int64_t ret_conv = Retry_clone_ptr(arg_conv);
52328         return ret_conv;
52329 }
52330
52331 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
52332         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
52333         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52334         *ret_copy = Retry_clone(orig_conv);
52335         uint64_t ret_ref = tag_ptr(ret_copy, true);
52336         return ret_ref;
52337 }
52338
52339 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
52340         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52341         *ret_copy = Retry_attempts(a);
52342         uint64_t ret_ref = tag_ptr(ret_copy, true);
52343         return ret_ref;
52344 }
52345
52346 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
52347         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
52348         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
52349         jboolean ret_conv = Retry_eq(a_conv, b_conv);
52350         return ret_conv;
52351 }
52352
52353 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
52354         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
52355         int64_t ret_conv = Retry_hash(o_conv);
52356         return ret_conv;
52357 }
52358
52359 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
52360         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
52361         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
52362         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52363         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52364         CVec_u8Z_free(ret_var);
52365         return ret_arr;
52366 }
52367
52368 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
52369         LDKu8slice ser_ref;
52370         ser_ref.datalen = ser->arr_len;
52371         ser_ref.data = ser->elems;
52372         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
52373         *ret_conv = Retry_read(ser_ref);
52374         FREE(ser);
52375         return tag_ptr(ret_conv, true);
52376 }
52377
52378 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
52379         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
52380         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
52381         return ret_conv;
52382 }
52383
52384 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
52385         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
52386         return ret_conv;
52387 }
52388
52389 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
52390         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
52391         return ret_conv;
52392 }
52393
52394 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
52395         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
52396         return ret_conv;
52397 }
52398
52399 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
52400         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
52401         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
52402         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
52403         return ret_conv;
52404 }
52405
52406 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
52407         if (!ptr_is_owned(this_ptr)) return;
52408         void* this_ptr_ptr = untag_ptr(this_ptr);
52409         CHECK_ACCESS(this_ptr_ptr);
52410         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
52411         FREE(untag_ptr(this_ptr));
52412         PaymentSendFailure_free(this_ptr_conv);
52413 }
52414
52415 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
52416         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52417         *ret_copy = PaymentSendFailure_clone(arg);
52418         uint64_t ret_ref = tag_ptr(ret_copy, true);
52419         return ret_ref;
52420 }
52421 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
52422         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
52423         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
52424         return ret_conv;
52425 }
52426
52427 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
52428         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
52429         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52430         *ret_copy = PaymentSendFailure_clone(orig_conv);
52431         uint64_t ret_ref = tag_ptr(ret_copy, true);
52432         return ret_ref;
52433 }
52434
52435 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
52436         void* a_ptr = untag_ptr(a);
52437         CHECK_ACCESS(a_ptr);
52438         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
52439         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
52440         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52441         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
52442         uint64_t ret_ref = tag_ptr(ret_copy, true);
52443         return ret_ref;
52444 }
52445
52446 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
52447         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
52448         a_constr.datalen = a->arr_len;
52449         if (a_constr.datalen > 0)
52450                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
52451         else
52452                 a_constr.data = NULL;
52453         uint64_t* a_vals = a->elems;
52454         for (size_t w = 0; w < a_constr.datalen; w++) {
52455                 uint64_t a_conv_22 = a_vals[w];
52456                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
52457                 CHECK_ACCESS(a_conv_22_ptr);
52458                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
52459                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
52460                 a_constr.data[w] = a_conv_22_conv;
52461         }
52462         FREE(a);
52463         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52464         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
52465         uint64_t ret_ref = tag_ptr(ret_copy, true);
52466         return ret_ref;
52467 }
52468
52469 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
52470         LDKCVec_APIErrorZ a_constr;
52471         a_constr.datalen = a->arr_len;
52472         if (a_constr.datalen > 0)
52473                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
52474         else
52475                 a_constr.data = NULL;
52476         uint64_t* a_vals = a->elems;
52477         for (size_t k = 0; k < a_constr.datalen; k++) {
52478                 uint64_t a_conv_10 = a_vals[k];
52479                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
52480                 CHECK_ACCESS(a_conv_10_ptr);
52481                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
52482                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
52483                 a_constr.data[k] = a_conv_10_conv;
52484         }
52485         FREE(a);
52486         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52487         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
52488         uint64_t ret_ref = tag_ptr(ret_copy, true);
52489         return ret_ref;
52490 }
52491
52492 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
52493         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52494         *ret_copy = PaymentSendFailure_duplicate_payment();
52495         uint64_t ret_ref = tag_ptr(ret_copy, true);
52496         return ret_ref;
52497 }
52498
52499 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) {
52500         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
52501         results_constr.datalen = results->arr_len;
52502         if (results_constr.datalen > 0)
52503                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
52504         else
52505                 results_constr.data = NULL;
52506         uint64_t* results_vals = results->elems;
52507         for (size_t w = 0; w < results_constr.datalen; w++) {
52508                 uint64_t results_conv_22 = results_vals[w];
52509                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
52510                 CHECK_ACCESS(results_conv_22_ptr);
52511                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
52512                 results_constr.data[w] = results_conv_22_conv;
52513         }
52514         FREE(results);
52515         LDKRouteParameters failed_paths_retry_conv;
52516         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
52517         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
52518         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
52519         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
52520         LDKThirtyTwoBytes payment_id_ref;
52521         CHECK(payment_id->arr_len == 32);
52522         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52523         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52524         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
52525         uint64_t ret_ref = tag_ptr(ret_copy, true);
52526         return ret_ref;
52527 }
52528
52529 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
52530         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
52531         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
52532         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
52533         return ret_conv;
52534 }
52535
52536 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
52537         if (!ptr_is_owned(this_ptr)) return;
52538         void* this_ptr_ptr = untag_ptr(this_ptr);
52539         CHECK_ACCESS(this_ptr_ptr);
52540         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
52541         FREE(untag_ptr(this_ptr));
52542         ProbeSendFailure_free(this_ptr_conv);
52543 }
52544
52545 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
52546         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
52547         *ret_copy = ProbeSendFailure_clone(arg);
52548         uint64_t ret_ref = tag_ptr(ret_copy, true);
52549         return ret_ref;
52550 }
52551 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
52552         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
52553         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
52554         return ret_conv;
52555 }
52556
52557 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
52558         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
52559         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
52560         *ret_copy = ProbeSendFailure_clone(orig_conv);
52561         uint64_t ret_ref = tag_ptr(ret_copy, true);
52562         return ret_ref;
52563 }
52564
52565 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
52566         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
52567         *ret_copy = ProbeSendFailure_route_not_found();
52568         uint64_t ret_ref = tag_ptr(ret_copy, true);
52569         return ret_ref;
52570 }
52571
52572 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
52573         void* a_ptr = untag_ptr(a);
52574         CHECK_ACCESS(a_ptr);
52575         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
52576         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
52577         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
52578         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
52579         uint64_t ret_ref = tag_ptr(ret_copy, true);
52580         return ret_ref;
52581 }
52582
52583 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
52584         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
52585         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
52586         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
52587         return ret_conv;
52588 }
52589
52590 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
52591         LDKRecipientOnionFields this_obj_conv;
52592         this_obj_conv.inner = untag_ptr(this_obj);
52593         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52595         RecipientOnionFields_free(this_obj_conv);
52596 }
52597
52598 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
52599         LDKRecipientOnionFields this_ptr_conv;
52600         this_ptr_conv.inner = untag_ptr(this_ptr);
52601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52603         this_ptr_conv.is_owned = false;
52604         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
52605         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
52606         uint64_t ret_ref = tag_ptr(ret_copy, true);
52607         return ret_ref;
52608 }
52609
52610 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
52611         LDKRecipientOnionFields this_ptr_conv;
52612         this_ptr_conv.inner = untag_ptr(this_ptr);
52613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52615         this_ptr_conv.is_owned = false;
52616         void* val_ptr = untag_ptr(val);
52617         CHECK_ACCESS(val_ptr);
52618         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
52619         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
52620         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
52621 }
52622
52623 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
52624         LDKRecipientOnionFields this_ptr_conv;
52625         this_ptr_conv.inner = untag_ptr(this_ptr);
52626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52628         this_ptr_conv.is_owned = false;
52629         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52630         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
52631         uint64_t ret_ref = tag_ptr(ret_copy, true);
52632         return ret_ref;
52633 }
52634
52635 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
52636         LDKRecipientOnionFields this_ptr_conv;
52637         this_ptr_conv.inner = untag_ptr(this_ptr);
52638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52640         this_ptr_conv.is_owned = false;
52641         void* val_ptr = untag_ptr(val);
52642         CHECK_ACCESS(val_ptr);
52643         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
52644         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
52645         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
52646 }
52647
52648 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
52649         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
52650         uint64_t ret_ref = 0;
52651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52653         return ret_ref;
52654 }
52655 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
52656         LDKRecipientOnionFields arg_conv;
52657         arg_conv.inner = untag_ptr(arg);
52658         arg_conv.is_owned = ptr_is_owned(arg);
52659         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52660         arg_conv.is_owned = false;
52661         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
52662         return ret_conv;
52663 }
52664
52665 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
52666         LDKRecipientOnionFields orig_conv;
52667         orig_conv.inner = untag_ptr(orig);
52668         orig_conv.is_owned = ptr_is_owned(orig);
52669         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52670         orig_conv.is_owned = false;
52671         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
52672         uint64_t ret_ref = 0;
52673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52675         return ret_ref;
52676 }
52677
52678 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
52679         LDKRecipientOnionFields a_conv;
52680         a_conv.inner = untag_ptr(a);
52681         a_conv.is_owned = ptr_is_owned(a);
52682         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52683         a_conv.is_owned = false;
52684         LDKRecipientOnionFields b_conv;
52685         b_conv.inner = untag_ptr(b);
52686         b_conv.is_owned = ptr_is_owned(b);
52687         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52688         b_conv.is_owned = false;
52689         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
52690         return ret_conv;
52691 }
52692
52693 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
52694         LDKRecipientOnionFields obj_conv;
52695         obj_conv.inner = untag_ptr(obj);
52696         obj_conv.is_owned = ptr_is_owned(obj);
52697         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52698         obj_conv.is_owned = false;
52699         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
52700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52702         CVec_u8Z_free(ret_var);
52703         return ret_arr;
52704 }
52705
52706 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
52707         LDKu8slice ser_ref;
52708         ser_ref.datalen = ser->arr_len;
52709         ser_ref.data = ser->elems;
52710         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
52711         *ret_conv = RecipientOnionFields_read(ser_ref);
52712         FREE(ser);
52713         return tag_ptr(ret_conv, true);
52714 }
52715
52716 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
52717         LDKThirtyTwoBytes payment_secret_ref;
52718         CHECK(payment_secret->arr_len == 32);
52719         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
52720         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
52721         uint64_t ret_ref = 0;
52722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52724         return ret_ref;
52725 }
52726
52727 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
52728         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
52729         uint64_t ret_ref = 0;
52730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52732         return ret_ref;
52733 }
52734
52735 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
52736         LDKRecipientOnionFields this_arg_conv;
52737         this_arg_conv.inner = untag_ptr(this_arg);
52738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52740         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
52741         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
52742         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
52743         if (custom_tlvs_constr.datalen > 0)
52744                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
52745         else
52746                 custom_tlvs_constr.data = NULL;
52747         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
52748         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
52749                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
52750                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
52751                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
52752                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
52753                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
52754                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
52755         }
52756         FREE(custom_tlvs);
52757         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
52758         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
52759         return tag_ptr(ret_conv, true);
52760 }
52761
52762 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
52763         LDKRecipientOnionFields this_arg_conv;
52764         this_arg_conv.inner = untag_ptr(this_arg);
52765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52767         this_arg_conv.is_owned = false;
52768         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
52769         uint64_tArray ret_arr = NULL;
52770         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52771         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52772         for (size_t x = 0; x < ret_var.datalen; x++) {
52773                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
52774                 *ret_conv_23_conv = ret_var.data[x];
52775                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
52776         }
52777         
52778         FREE(ret_var.data);
52779         return ret_arr;
52780 }
52781
52782 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
52783         if (!ptr_is_owned(this_ptr)) return;
52784         void* this_ptr_ptr = untag_ptr(this_ptr);
52785         CHECK_ACCESS(this_ptr_ptr);
52786         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
52787         FREE(untag_ptr(this_ptr));
52788         CustomMessageReader_free(this_ptr_conv);
52789 }
52790
52791 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
52792         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
52793         *ret_ret = Type_clone(arg);
52794         return tag_ptr(ret_ret, true);
52795 }
52796 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
52797         void* arg_ptr = untag_ptr(arg);
52798         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52799         LDKType* arg_conv = (LDKType*)arg_ptr;
52800         int64_t ret_conv = Type_clone_ptr(arg_conv);
52801         return ret_conv;
52802 }
52803
52804 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
52805         void* orig_ptr = untag_ptr(orig);
52806         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52807         LDKType* orig_conv = (LDKType*)orig_ptr;
52808         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
52809         *ret_ret = Type_clone(orig_conv);
52810         return tag_ptr(ret_ret, true);
52811 }
52812
52813 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
52814         if (!ptr_is_owned(this_ptr)) return;
52815         void* this_ptr_ptr = untag_ptr(this_ptr);
52816         CHECK_ACCESS(this_ptr_ptr);
52817         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
52818         FREE(untag_ptr(this_ptr));
52819         Type_free(this_ptr_conv);
52820 }
52821
52822 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
52823         LDKOffer this_obj_conv;
52824         this_obj_conv.inner = untag_ptr(this_obj);
52825         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52827         Offer_free(this_obj_conv);
52828 }
52829
52830 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
52831         LDKOffer ret_var = Offer_clone(arg);
52832         uint64_t ret_ref = 0;
52833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52835         return ret_ref;
52836 }
52837 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
52838         LDKOffer arg_conv;
52839         arg_conv.inner = untag_ptr(arg);
52840         arg_conv.is_owned = ptr_is_owned(arg);
52841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52842         arg_conv.is_owned = false;
52843         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
52844         return ret_conv;
52845 }
52846
52847 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
52848         LDKOffer orig_conv;
52849         orig_conv.inner = untag_ptr(orig);
52850         orig_conv.is_owned = ptr_is_owned(orig);
52851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52852         orig_conv.is_owned = false;
52853         LDKOffer ret_var = Offer_clone(&orig_conv);
52854         uint64_t ret_ref = 0;
52855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52857         return ret_ref;
52858 }
52859
52860 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
52861         LDKOffer this_arg_conv;
52862         this_arg_conv.inner = untag_ptr(this_arg);
52863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52865         this_arg_conv.is_owned = false;
52866         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
52867         ptrArray ret_arr = NULL;
52868         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
52869         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
52870         for (size_t m = 0; m < ret_var.datalen; m++) {
52871                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
52872                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
52873                 ret_arr_ptr[m] = ret_conv_12_arr;
52874         }
52875         
52876         FREE(ret_var.data);
52877         return ret_arr;
52878 }
52879
52880 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
52881         LDKOffer this_arg_conv;
52882         this_arg_conv.inner = untag_ptr(this_arg);
52883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52885         this_arg_conv.is_owned = false;
52886         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52887         *ret_copy = Offer_metadata(&this_arg_conv);
52888         uint64_t ret_ref = tag_ptr(ret_copy, true);
52889         return ret_ref;
52890 }
52891
52892 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
52893         LDKOffer this_arg_conv;
52894         this_arg_conv.inner = untag_ptr(this_arg);
52895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52897         this_arg_conv.is_owned = false;
52898         LDKAmount ret_var = Offer_amount(&this_arg_conv);
52899         uint64_t ret_ref = 0;
52900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52902         return ret_ref;
52903 }
52904
52905 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
52906         LDKOffer this_arg_conv;
52907         this_arg_conv.inner = untag_ptr(this_arg);
52908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52910         this_arg_conv.is_owned = false;
52911         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
52912         uint64_t ret_ref = 0;
52913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52915         return ret_ref;
52916 }
52917
52918 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
52919         LDKOffer this_arg_conv;
52920         this_arg_conv.inner = untag_ptr(this_arg);
52921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52923         this_arg_conv.is_owned = false;
52924         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
52925         uint64_t ret_ref = 0;
52926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52928         return ret_ref;
52929 }
52930
52931 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
52932         LDKOffer this_arg_conv;
52933         this_arg_conv.inner = untag_ptr(this_arg);
52934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52936         this_arg_conv.is_owned = false;
52937         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52938         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
52939         uint64_t ret_ref = tag_ptr(ret_copy, true);
52940         return ret_ref;
52941 }
52942
52943 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
52944         LDKOffer this_arg_conv;
52945         this_arg_conv.inner = untag_ptr(this_arg);
52946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52948         this_arg_conv.is_owned = false;
52949         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
52950         uint64_t ret_ref = 0;
52951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52953         return ret_ref;
52954 }
52955
52956 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
52957         LDKOffer this_arg_conv;
52958         this_arg_conv.inner = untag_ptr(this_arg);
52959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52961         this_arg_conv.is_owned = false;
52962         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
52963         uint64_tArray ret_arr = NULL;
52964         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52965         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52966         for (size_t n = 0; n < ret_var.datalen; n++) {
52967                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
52968                 uint64_t ret_conv_13_ref = 0;
52969                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
52970                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
52971                 ret_arr_ptr[n] = ret_conv_13_ref;
52972         }
52973         
52974         FREE(ret_var.data);
52975         return ret_arr;
52976 }
52977
52978 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
52979         LDKOffer this_arg_conv;
52980         this_arg_conv.inner = untag_ptr(this_arg);
52981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52983         this_arg_conv.is_owned = false;
52984         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
52985         uint64_t ret_ref = 0;
52986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52988         return ret_ref;
52989 }
52990
52991 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
52992         LDKOffer this_arg_conv;
52993         this_arg_conv.inner = untag_ptr(this_arg);
52994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52996         this_arg_conv.is_owned = false;
52997         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52998         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
52999         return ret_arr;
53000 }
53001
53002 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
53003         LDKOffer this_arg_conv;
53004         this_arg_conv.inner = untag_ptr(this_arg);
53005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53007         this_arg_conv.is_owned = false;
53008         LDKThirtyTwoBytes chain_ref;
53009         CHECK(chain->arr_len == 32);
53010         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
53011         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
53012         return ret_conv;
53013 }
53014
53015 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
53016         LDKOffer this_arg_conv;
53017         this_arg_conv.inner = untag_ptr(this_arg);
53018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53020         this_arg_conv.is_owned = false;
53021         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
53022         return ret_conv;
53023 }
53024
53025 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
53026         LDKOffer this_arg_conv;
53027         this_arg_conv.inner = untag_ptr(this_arg);
53028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53030         this_arg_conv.is_owned = false;
53031         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
53032         return ret_conv;
53033 }
53034
53035 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
53036         LDKOffer obj_conv;
53037         obj_conv.inner = untag_ptr(obj);
53038         obj_conv.is_owned = ptr_is_owned(obj);
53039         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53040         obj_conv.is_owned = false;
53041         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
53042         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53043         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53044         CVec_u8Z_free(ret_var);
53045         return ret_arr;
53046 }
53047
53048 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
53049         LDKAmount this_obj_conv;
53050         this_obj_conv.inner = untag_ptr(this_obj);
53051         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53053         Amount_free(this_obj_conv);
53054 }
53055
53056 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
53057         LDKAmount ret_var = Amount_clone(arg);
53058         uint64_t ret_ref = 0;
53059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53061         return ret_ref;
53062 }
53063 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
53064         LDKAmount arg_conv;
53065         arg_conv.inner = untag_ptr(arg);
53066         arg_conv.is_owned = ptr_is_owned(arg);
53067         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53068         arg_conv.is_owned = false;
53069         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
53070         return ret_conv;
53071 }
53072
53073 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
53074         LDKAmount orig_conv;
53075         orig_conv.inner = untag_ptr(orig);
53076         orig_conv.is_owned = ptr_is_owned(orig);
53077         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53078         orig_conv.is_owned = false;
53079         LDKAmount ret_var = Amount_clone(&orig_conv);
53080         uint64_t ret_ref = 0;
53081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53083         return ret_ref;
53084 }
53085
53086 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
53087         LDKQuantity this_obj_conv;
53088         this_obj_conv.inner = untag_ptr(this_obj);
53089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53091         Quantity_free(this_obj_conv);
53092 }
53093
53094 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
53095         LDKQuantity ret_var = Quantity_clone(arg);
53096         uint64_t ret_ref = 0;
53097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53099         return ret_ref;
53100 }
53101 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
53102         LDKQuantity arg_conv;
53103         arg_conv.inner = untag_ptr(arg);
53104         arg_conv.is_owned = ptr_is_owned(arg);
53105         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53106         arg_conv.is_owned = false;
53107         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
53108         return ret_conv;
53109 }
53110
53111 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
53112         LDKQuantity orig_conv;
53113         orig_conv.inner = untag_ptr(orig);
53114         orig_conv.is_owned = ptr_is_owned(orig);
53115         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53116         orig_conv.is_owned = false;
53117         LDKQuantity ret_var = Quantity_clone(&orig_conv);
53118         uint64_t ret_ref = 0;
53119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53121         return ret_ref;
53122 }
53123
53124 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
53125         LDKStr s_conv = str_ref_to_owned_c(s);
53126         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
53127         *ret_conv = Offer_from_str(s_conv);
53128         return tag_ptr(ret_conv, true);
53129 }
53130
53131 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
53132         LDKUnsignedBolt12Invoice this_obj_conv;
53133         this_obj_conv.inner = untag_ptr(this_obj);
53134         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53136         UnsignedBolt12Invoice_free(this_obj_conv);
53137 }
53138
53139 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
53140         LDKUnsignedBolt12Invoice this_arg_conv;
53141         this_arg_conv.inner = untag_ptr(this_arg);
53142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53144         this_arg_conv.is_owned = false;
53145         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
53146         uint64_t ret_ref = 0;
53147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53149         return ret_ref;
53150 }
53151
53152 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
53153         LDKBolt12Invoice 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         Bolt12Invoice_free(this_obj_conv);
53158 }
53159
53160 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
53161         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
53162         uint64_t ret_ref = 0;
53163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53165         return ret_ref;
53166 }
53167 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
53168         LDKBolt12Invoice arg_conv;
53169         arg_conv.inner = untag_ptr(arg);
53170         arg_conv.is_owned = ptr_is_owned(arg);
53171         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53172         arg_conv.is_owned = false;
53173         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
53174         return ret_conv;
53175 }
53176
53177 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
53178         LDKBolt12Invoice orig_conv;
53179         orig_conv.inner = untag_ptr(orig);
53180         orig_conv.is_owned = ptr_is_owned(orig);
53181         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53182         orig_conv.is_owned = false;
53183         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
53184         uint64_t ret_ref = 0;
53185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53187         return ret_ref;
53188 }
53189
53190 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
53191         LDKUnsignedBolt12Invoice this_arg_conv;
53192         this_arg_conv.inner = untag_ptr(this_arg);
53193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53195         this_arg_conv.is_owned = false;
53196         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
53197         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
53198         uint64_t ret_ref = tag_ptr(ret_copy, true);
53199         return ret_ref;
53200 }
53201
53202 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
53203         LDKUnsignedBolt12Invoice this_arg_conv;
53204         this_arg_conv.inner = untag_ptr(this_arg);
53205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53207         this_arg_conv.is_owned = false;
53208         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53209         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
53210         return ret_arr;
53211 }
53212
53213 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
53214         LDKUnsignedBolt12Invoice this_arg_conv;
53215         this_arg_conv.inner = untag_ptr(this_arg);
53216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53218         this_arg_conv.is_owned = false;
53219         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53220         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
53221         uint64_t ret_ref = tag_ptr(ret_copy, true);
53222         return ret_ref;
53223 }
53224
53225 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
53226         LDKUnsignedBolt12Invoice this_arg_conv;
53227         this_arg_conv.inner = untag_ptr(this_arg);
53228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53230         this_arg_conv.is_owned = false;
53231         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
53232         uint64_t ret_ref = 0;
53233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53235         return ret_ref;
53236 }
53237
53238 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
53239         LDKUnsignedBolt12Invoice this_arg_conv;
53240         this_arg_conv.inner = untag_ptr(this_arg);
53241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53243         this_arg_conv.is_owned = false;
53244         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
53245         uint64_t ret_ref = 0;
53246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53248         return ret_ref;
53249 }
53250
53251 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
53252         LDKUnsignedBolt12Invoice this_arg_conv;
53253         this_arg_conv.inner = untag_ptr(this_arg);
53254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53256         this_arg_conv.is_owned = false;
53257         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
53258         uint64_t ret_ref = 0;
53259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53261         return ret_ref;
53262 }
53263
53264 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
53265         LDKUnsignedBolt12Invoice this_arg_conv;
53266         this_arg_conv.inner = untag_ptr(this_arg);
53267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53269         this_arg_conv.is_owned = false;
53270         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53271         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
53272         uint64_t ret_ref = tag_ptr(ret_copy, true);
53273         return ret_ref;
53274 }
53275
53276 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
53277         LDKUnsignedBolt12Invoice this_arg_conv;
53278         this_arg_conv.inner = untag_ptr(this_arg);
53279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53281         this_arg_conv.is_owned = false;
53282         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
53283         uint64_t ret_ref = 0;
53284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53286         return ret_ref;
53287 }
53288
53289 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
53290         LDKUnsignedBolt12Invoice this_arg_conv;
53291         this_arg_conv.inner = untag_ptr(this_arg);
53292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53294         this_arg_conv.is_owned = false;
53295         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
53296         uint64_tArray ret_arr = NULL;
53297         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53298         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53299         for (size_t n = 0; n < ret_var.datalen; n++) {
53300                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
53301                 uint64_t ret_conv_13_ref = 0;
53302                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
53303                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
53304                 ret_arr_ptr[n] = ret_conv_13_ref;
53305         }
53306         
53307         FREE(ret_var.data);
53308         return ret_arr;
53309 }
53310
53311 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
53312         LDKUnsignedBolt12Invoice this_arg_conv;
53313         this_arg_conv.inner = untag_ptr(this_arg);
53314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53316         this_arg_conv.is_owned = false;
53317         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
53318         uint64_t ret_ref = 0;
53319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53321         return ret_ref;
53322 }
53323
53324 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
53325         LDKUnsignedBolt12Invoice this_arg_conv;
53326         this_arg_conv.inner = untag_ptr(this_arg);
53327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53329         this_arg_conv.is_owned = false;
53330         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
53331         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53332         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53333         return ret_arr;
53334 }
53335
53336 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
53337         LDKUnsignedBolt12Invoice this_arg_conv;
53338         this_arg_conv.inner = untag_ptr(this_arg);
53339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53341         this_arg_conv.is_owned = false;
53342         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
53343         uint64_t ret_ref = 0;
53344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53346         return ret_ref;
53347 }
53348
53349 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
53350         LDKUnsignedBolt12Invoice this_arg_conv;
53351         this_arg_conv.inner = untag_ptr(this_arg);
53352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53354         this_arg_conv.is_owned = false;
53355         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53356         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
53357         uint64_t ret_ref = tag_ptr(ret_copy, true);
53358         return ret_ref;
53359 }
53360
53361 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
53362         LDKUnsignedBolt12Invoice this_arg_conv;
53363         this_arg_conv.inner = untag_ptr(this_arg);
53364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53366         this_arg_conv.is_owned = false;
53367         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53368         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
53369         return ret_arr;
53370 }
53371
53372 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
53373         LDKUnsignedBolt12Invoice this_arg_conv;
53374         this_arg_conv.inner = untag_ptr(this_arg);
53375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53377         this_arg_conv.is_owned = false;
53378         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
53379         uint64_t ret_ref = 0;
53380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53382         return ret_ref;
53383 }
53384
53385 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
53386         LDKUnsignedBolt12Invoice this_arg_conv;
53387         this_arg_conv.inner = untag_ptr(this_arg);
53388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53390         this_arg_conv.is_owned = false;
53391         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
53392         return ret_conv;
53393 }
53394
53395 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
53396         LDKUnsignedBolt12Invoice this_arg_conv;
53397         this_arg_conv.inner = untag_ptr(this_arg);
53398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53400         this_arg_conv.is_owned = false;
53401         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
53402         return ret_conv;
53403 }
53404
53405 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
53406         LDKUnsignedBolt12Invoice this_arg_conv;
53407         this_arg_conv.inner = untag_ptr(this_arg);
53408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53410         this_arg_conv.is_owned = false;
53411         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53412         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
53413         return ret_arr;
53414 }
53415
53416 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
53417         LDKUnsignedBolt12Invoice this_arg_conv;
53418         this_arg_conv.inner = untag_ptr(this_arg);
53419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53421         this_arg_conv.is_owned = false;
53422         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
53423         return ret_conv;
53424 }
53425
53426 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
53427         LDKUnsignedBolt12Invoice this_arg_conv;
53428         this_arg_conv.inner = untag_ptr(this_arg);
53429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53431         this_arg_conv.is_owned = false;
53432         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
53433         uint64_t ret_ref = 0;
53434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53436         return ret_ref;
53437 }
53438
53439 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
53440         LDKUnsignedBolt12Invoice this_arg_conv;
53441         this_arg_conv.inner = untag_ptr(this_arg);
53442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53444         this_arg_conv.is_owned = false;
53445         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53446         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
53447         return ret_arr;
53448 }
53449
53450 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
53451         LDKBolt12Invoice this_arg_conv;
53452         this_arg_conv.inner = untag_ptr(this_arg);
53453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53455         this_arg_conv.is_owned = false;
53456         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
53457         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
53458         uint64_t ret_ref = tag_ptr(ret_copy, true);
53459         return ret_ref;
53460 }
53461
53462 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
53463         LDKBolt12Invoice this_arg_conv;
53464         this_arg_conv.inner = untag_ptr(this_arg);
53465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53467         this_arg_conv.is_owned = false;
53468         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53469         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
53470         return ret_arr;
53471 }
53472
53473 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
53474         LDKBolt12Invoice this_arg_conv;
53475         this_arg_conv.inner = untag_ptr(this_arg);
53476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53478         this_arg_conv.is_owned = false;
53479         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53480         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
53481         uint64_t ret_ref = tag_ptr(ret_copy, true);
53482         return ret_ref;
53483 }
53484
53485 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
53486         LDKBolt12Invoice this_arg_conv;
53487         this_arg_conv.inner = untag_ptr(this_arg);
53488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53490         this_arg_conv.is_owned = false;
53491         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
53492         uint64_t ret_ref = 0;
53493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53495         return ret_ref;
53496 }
53497
53498 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
53499         LDKBolt12Invoice this_arg_conv;
53500         this_arg_conv.inner = untag_ptr(this_arg);
53501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53503         this_arg_conv.is_owned = false;
53504         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
53505         uint64_t ret_ref = 0;
53506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53508         return ret_ref;
53509 }
53510
53511 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
53512         LDKBolt12Invoice this_arg_conv;
53513         this_arg_conv.inner = untag_ptr(this_arg);
53514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53516         this_arg_conv.is_owned = false;
53517         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
53518         uint64_t ret_ref = 0;
53519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53521         return ret_ref;
53522 }
53523
53524 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
53525         LDKBolt12Invoice this_arg_conv;
53526         this_arg_conv.inner = untag_ptr(this_arg);
53527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53529         this_arg_conv.is_owned = false;
53530         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53531         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
53532         uint64_t ret_ref = tag_ptr(ret_copy, true);
53533         return ret_ref;
53534 }
53535
53536 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
53537         LDKBolt12Invoice this_arg_conv;
53538         this_arg_conv.inner = untag_ptr(this_arg);
53539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53541         this_arg_conv.is_owned = false;
53542         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
53543         uint64_t ret_ref = 0;
53544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53546         return ret_ref;
53547 }
53548
53549 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
53550         LDKBolt12Invoice this_arg_conv;
53551         this_arg_conv.inner = untag_ptr(this_arg);
53552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53554         this_arg_conv.is_owned = false;
53555         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
53556         uint64_tArray ret_arr = NULL;
53557         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53558         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53559         for (size_t n = 0; n < ret_var.datalen; n++) {
53560                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
53561                 uint64_t ret_conv_13_ref = 0;
53562                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
53563                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
53564                 ret_arr_ptr[n] = ret_conv_13_ref;
53565         }
53566         
53567         FREE(ret_var.data);
53568         return ret_arr;
53569 }
53570
53571 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
53572         LDKBolt12Invoice this_arg_conv;
53573         this_arg_conv.inner = untag_ptr(this_arg);
53574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53576         this_arg_conv.is_owned = false;
53577         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
53578         uint64_t ret_ref = 0;
53579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53581         return ret_ref;
53582 }
53583
53584 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
53585         LDKBolt12Invoice this_arg_conv;
53586         this_arg_conv.inner = untag_ptr(this_arg);
53587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53589         this_arg_conv.is_owned = false;
53590         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
53591         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53592         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53593         return ret_arr;
53594 }
53595
53596 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
53597         LDKBolt12Invoice this_arg_conv;
53598         this_arg_conv.inner = untag_ptr(this_arg);
53599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53601         this_arg_conv.is_owned = false;
53602         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
53603         uint64_t ret_ref = 0;
53604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53606         return ret_ref;
53607 }
53608
53609 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
53610         LDKBolt12Invoice this_arg_conv;
53611         this_arg_conv.inner = untag_ptr(this_arg);
53612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53614         this_arg_conv.is_owned = false;
53615         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53616         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
53617         uint64_t ret_ref = tag_ptr(ret_copy, true);
53618         return ret_ref;
53619 }
53620
53621 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
53622         LDKBolt12Invoice this_arg_conv;
53623         this_arg_conv.inner = untag_ptr(this_arg);
53624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53626         this_arg_conv.is_owned = false;
53627         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53628         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
53629         return ret_arr;
53630 }
53631
53632 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
53633         LDKBolt12Invoice this_arg_conv;
53634         this_arg_conv.inner = untag_ptr(this_arg);
53635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53637         this_arg_conv.is_owned = false;
53638         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
53639         uint64_t ret_ref = 0;
53640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53642         return ret_ref;
53643 }
53644
53645 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
53646         LDKBolt12Invoice this_arg_conv;
53647         this_arg_conv.inner = untag_ptr(this_arg);
53648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53650         this_arg_conv.is_owned = false;
53651         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
53652         return ret_conv;
53653 }
53654
53655 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
53656         LDKBolt12Invoice 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         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
53662         return ret_conv;
53663 }
53664
53665 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
53666         LDKBolt12Invoice this_arg_conv;
53667         this_arg_conv.inner = untag_ptr(this_arg);
53668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53670         this_arg_conv.is_owned = false;
53671         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53672         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
53673         return ret_arr;
53674 }
53675
53676 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
53677         LDKBolt12Invoice this_arg_conv;
53678         this_arg_conv.inner = untag_ptr(this_arg);
53679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53681         this_arg_conv.is_owned = false;
53682         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
53683         return ret_conv;
53684 }
53685
53686 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
53687         LDKBolt12Invoice this_arg_conv;
53688         this_arg_conv.inner = untag_ptr(this_arg);
53689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53691         this_arg_conv.is_owned = false;
53692         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
53693         uint64_t ret_ref = 0;
53694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53696         return ret_ref;
53697 }
53698
53699 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
53700         LDKBolt12Invoice this_arg_conv;
53701         this_arg_conv.inner = untag_ptr(this_arg);
53702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53704         this_arg_conv.is_owned = false;
53705         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53706         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
53707         return ret_arr;
53708 }
53709
53710 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
53711         LDKBolt12Invoice this_arg_conv;
53712         this_arg_conv.inner = untag_ptr(this_arg);
53713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53715         this_arg_conv.is_owned = false;
53716         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53717         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
53718         return ret_arr;
53719 }
53720
53721 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
53722         LDKBolt12Invoice this_arg_conv;
53723         this_arg_conv.inner = untag_ptr(this_arg);
53724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53726         this_arg_conv.is_owned = false;
53727         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53728         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
53729         return ret_arr;
53730 }
53731
53732 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
53733         LDKBolt12Invoice this_arg_conv;
53734         this_arg_conv.inner = untag_ptr(this_arg);
53735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53737         this_arg_conv.is_owned = false;
53738         LDKExpandedKey key_conv;
53739         key_conv.inner = untag_ptr(key);
53740         key_conv.is_owned = ptr_is_owned(key);
53741         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
53742         key_conv.is_owned = false;
53743         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
53744         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
53745         return tag_ptr(ret_conv, true);
53746 }
53747
53748 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
53749         LDKUnsignedBolt12Invoice obj_conv;
53750         obj_conv.inner = untag_ptr(obj);
53751         obj_conv.is_owned = ptr_is_owned(obj);
53752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53753         obj_conv.is_owned = false;
53754         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
53755         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53756         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53757         CVec_u8Z_free(ret_var);
53758         return ret_arr;
53759 }
53760
53761 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
53762         LDKBolt12Invoice obj_conv;
53763         obj_conv.inner = untag_ptr(obj);
53764         obj_conv.is_owned = ptr_is_owned(obj);
53765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53766         obj_conv.is_owned = false;
53767         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
53768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53770         CVec_u8Z_free(ret_var);
53771         return ret_arr;
53772 }
53773
53774 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
53775         LDKBlindedPayInfo this_obj_conv;
53776         this_obj_conv.inner = untag_ptr(this_obj);
53777         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53779         BlindedPayInfo_free(this_obj_conv);
53780 }
53781
53782 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
53783         LDKBlindedPayInfo this_ptr_conv;
53784         this_ptr_conv.inner = untag_ptr(this_ptr);
53785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53787         this_ptr_conv.is_owned = false;
53788         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
53789         return ret_conv;
53790 }
53791
53792 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
53793         LDKBlindedPayInfo this_ptr_conv;
53794         this_ptr_conv.inner = untag_ptr(this_ptr);
53795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53797         this_ptr_conv.is_owned = false;
53798         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
53799 }
53800
53801 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
53802         LDKBlindedPayInfo this_ptr_conv;
53803         this_ptr_conv.inner = untag_ptr(this_ptr);
53804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53806         this_ptr_conv.is_owned = false;
53807         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
53808         return ret_conv;
53809 }
53810
53811 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
53812         LDKBlindedPayInfo this_ptr_conv;
53813         this_ptr_conv.inner = untag_ptr(this_ptr);
53814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53816         this_ptr_conv.is_owned = false;
53817         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
53818 }
53819
53820 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
53821         LDKBlindedPayInfo this_ptr_conv;
53822         this_ptr_conv.inner = untag_ptr(this_ptr);
53823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53825         this_ptr_conv.is_owned = false;
53826         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
53827         return ret_conv;
53828 }
53829
53830 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
53831         LDKBlindedPayInfo this_ptr_conv;
53832         this_ptr_conv.inner = untag_ptr(this_ptr);
53833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53835         this_ptr_conv.is_owned = false;
53836         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
53837 }
53838
53839 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
53840         LDKBlindedPayInfo this_ptr_conv;
53841         this_ptr_conv.inner = untag_ptr(this_ptr);
53842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53844         this_ptr_conv.is_owned = false;
53845         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
53846         return ret_conv;
53847 }
53848
53849 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
53850         LDKBlindedPayInfo this_ptr_conv;
53851         this_ptr_conv.inner = untag_ptr(this_ptr);
53852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53854         this_ptr_conv.is_owned = false;
53855         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
53856 }
53857
53858 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
53859         LDKBlindedPayInfo this_ptr_conv;
53860         this_ptr_conv.inner = untag_ptr(this_ptr);
53861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53863         this_ptr_conv.is_owned = false;
53864         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
53865         return ret_conv;
53866 }
53867
53868 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
53869         LDKBlindedPayInfo this_ptr_conv;
53870         this_ptr_conv.inner = untag_ptr(this_ptr);
53871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53873         this_ptr_conv.is_owned = false;
53874         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
53875 }
53876
53877 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
53878         LDKBlindedPayInfo this_ptr_conv;
53879         this_ptr_conv.inner = untag_ptr(this_ptr);
53880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53882         this_ptr_conv.is_owned = false;
53883         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
53884         uint64_t ret_ref = 0;
53885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53887         return ret_ref;
53888 }
53889
53890 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
53891         LDKBlindedPayInfo this_ptr_conv;
53892         this_ptr_conv.inner = untag_ptr(this_ptr);
53893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53895         this_ptr_conv.is_owned = false;
53896         LDKBlindedHopFeatures val_conv;
53897         val_conv.inner = untag_ptr(val);
53898         val_conv.is_owned = ptr_is_owned(val);
53899         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53900         val_conv = BlindedHopFeatures_clone(&val_conv);
53901         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
53902 }
53903
53904 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) {
53905         LDKBlindedHopFeatures features_arg_conv;
53906         features_arg_conv.inner = untag_ptr(features_arg);
53907         features_arg_conv.is_owned = ptr_is_owned(features_arg);
53908         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
53909         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
53910         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);
53911         uint64_t ret_ref = 0;
53912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53914         return ret_ref;
53915 }
53916
53917 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
53918         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
53919         uint64_t ret_ref = 0;
53920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53922         return ret_ref;
53923 }
53924 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
53925         LDKBlindedPayInfo arg_conv;
53926         arg_conv.inner = untag_ptr(arg);
53927         arg_conv.is_owned = ptr_is_owned(arg);
53928         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53929         arg_conv.is_owned = false;
53930         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
53931         return ret_conv;
53932 }
53933
53934 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
53935         LDKBlindedPayInfo orig_conv;
53936         orig_conv.inner = untag_ptr(orig);
53937         orig_conv.is_owned = ptr_is_owned(orig);
53938         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53939         orig_conv.is_owned = false;
53940         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
53941         uint64_t ret_ref = 0;
53942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53944         return ret_ref;
53945 }
53946
53947 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
53948         LDKBlindedPayInfo o_conv;
53949         o_conv.inner = untag_ptr(o);
53950         o_conv.is_owned = ptr_is_owned(o);
53951         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53952         o_conv.is_owned = false;
53953         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
53954         return ret_conv;
53955 }
53956
53957 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
53958         LDKBlindedPayInfo a_conv;
53959         a_conv.inner = untag_ptr(a);
53960         a_conv.is_owned = ptr_is_owned(a);
53961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53962         a_conv.is_owned = false;
53963         LDKBlindedPayInfo b_conv;
53964         b_conv.inner = untag_ptr(b);
53965         b_conv.is_owned = ptr_is_owned(b);
53966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53967         b_conv.is_owned = false;
53968         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
53969         return ret_conv;
53970 }
53971
53972 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
53973         LDKBlindedPayInfo obj_conv;
53974         obj_conv.inner = untag_ptr(obj);
53975         obj_conv.is_owned = ptr_is_owned(obj);
53976         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53977         obj_conv.is_owned = false;
53978         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
53979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53981         CVec_u8Z_free(ret_var);
53982         return ret_arr;
53983 }
53984
53985 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
53986         LDKu8slice ser_ref;
53987         ser_ref.datalen = ser->arr_len;
53988         ser_ref.data = ser->elems;
53989         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
53990         *ret_conv = BlindedPayInfo_read(ser_ref);
53991         FREE(ser);
53992         return tag_ptr(ret_conv, true);
53993 }
53994
53995 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
53996         LDKInvoiceError this_obj_conv;
53997         this_obj_conv.inner = untag_ptr(this_obj);
53998         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54000         InvoiceError_free(this_obj_conv);
54001 }
54002
54003 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
54004         LDKInvoiceError this_ptr_conv;
54005         this_ptr_conv.inner = untag_ptr(this_ptr);
54006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54008         this_ptr_conv.is_owned = false;
54009         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
54010         uint64_t ret_ref = 0;
54011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54013         return ret_ref;
54014 }
54015
54016 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
54017         LDKInvoiceError this_ptr_conv;
54018         this_ptr_conv.inner = untag_ptr(this_ptr);
54019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54021         this_ptr_conv.is_owned = false;
54022         LDKErroneousField val_conv;
54023         val_conv.inner = untag_ptr(val);
54024         val_conv.is_owned = ptr_is_owned(val);
54025         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54026         val_conv = ErroneousField_clone(&val_conv);
54027         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
54028 }
54029
54030 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
54031         LDKInvoiceError this_ptr_conv;
54032         this_ptr_conv.inner = untag_ptr(this_ptr);
54033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54035         this_ptr_conv.is_owned = false;
54036         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
54037         uint64_t ret_ref = 0;
54038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54040         return ret_ref;
54041 }
54042
54043 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
54044         LDKInvoiceError this_ptr_conv;
54045         this_ptr_conv.inner = untag_ptr(this_ptr);
54046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54048         this_ptr_conv.is_owned = false;
54049         LDKUntrustedString val_conv;
54050         val_conv.inner = untag_ptr(val);
54051         val_conv.is_owned = ptr_is_owned(val);
54052         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54053         val_conv = UntrustedString_clone(&val_conv);
54054         InvoiceError_set_message(&this_ptr_conv, val_conv);
54055 }
54056
54057 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
54058         LDKErroneousField erroneous_field_arg_conv;
54059         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
54060         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
54061         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
54062         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
54063         LDKUntrustedString message_arg_conv;
54064         message_arg_conv.inner = untag_ptr(message_arg);
54065         message_arg_conv.is_owned = ptr_is_owned(message_arg);
54066         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
54067         message_arg_conv = UntrustedString_clone(&message_arg_conv);
54068         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
54069         uint64_t ret_ref = 0;
54070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54072         return ret_ref;
54073 }
54074
54075 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
54076         LDKInvoiceError ret_var = InvoiceError_clone(arg);
54077         uint64_t ret_ref = 0;
54078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54080         return ret_ref;
54081 }
54082 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
54083         LDKInvoiceError arg_conv;
54084         arg_conv.inner = untag_ptr(arg);
54085         arg_conv.is_owned = ptr_is_owned(arg);
54086         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54087         arg_conv.is_owned = false;
54088         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
54089         return ret_conv;
54090 }
54091
54092 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
54093         LDKInvoiceError orig_conv;
54094         orig_conv.inner = untag_ptr(orig);
54095         orig_conv.is_owned = ptr_is_owned(orig);
54096         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54097         orig_conv.is_owned = false;
54098         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
54099         uint64_t ret_ref = 0;
54100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54102         return ret_ref;
54103 }
54104
54105 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
54106         LDKErroneousField this_obj_conv;
54107         this_obj_conv.inner = untag_ptr(this_obj);
54108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54110         ErroneousField_free(this_obj_conv);
54111 }
54112
54113 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
54114         LDKErroneousField this_ptr_conv;
54115         this_ptr_conv.inner = untag_ptr(this_ptr);
54116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54118         this_ptr_conv.is_owned = false;
54119         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
54120         return ret_conv;
54121 }
54122
54123 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
54124         LDKErroneousField this_ptr_conv;
54125         this_ptr_conv.inner = untag_ptr(this_ptr);
54126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54128         this_ptr_conv.is_owned = false;
54129         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
54130 }
54131
54132 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
54133         LDKErroneousField this_ptr_conv;
54134         this_ptr_conv.inner = untag_ptr(this_ptr);
54135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54137         this_ptr_conv.is_owned = false;
54138         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54139         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
54140         uint64_t ret_ref = tag_ptr(ret_copy, true);
54141         return ret_ref;
54142 }
54143
54144 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
54145         LDKErroneousField this_ptr_conv;
54146         this_ptr_conv.inner = untag_ptr(this_ptr);
54147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54149         this_ptr_conv.is_owned = false;
54150         void* val_ptr = untag_ptr(val);
54151         CHECK_ACCESS(val_ptr);
54152         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
54153         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
54154         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
54155 }
54156
54157 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
54158         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
54159         CHECK_ACCESS(suggested_value_arg_ptr);
54160         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
54161         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
54162         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
54163         uint64_t ret_ref = 0;
54164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54166         return ret_ref;
54167 }
54168
54169 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
54170         LDKErroneousField ret_var = ErroneousField_clone(arg);
54171         uint64_t ret_ref = 0;
54172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54174         return ret_ref;
54175 }
54176 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
54177         LDKErroneousField arg_conv;
54178         arg_conv.inner = untag_ptr(arg);
54179         arg_conv.is_owned = ptr_is_owned(arg);
54180         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54181         arg_conv.is_owned = false;
54182         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
54183         return ret_conv;
54184 }
54185
54186 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
54187         LDKErroneousField orig_conv;
54188         orig_conv.inner = untag_ptr(orig);
54189         orig_conv.is_owned = ptr_is_owned(orig);
54190         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54191         orig_conv.is_owned = false;
54192         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
54193         uint64_t ret_ref = 0;
54194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54196         return ret_ref;
54197 }
54198
54199 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
54200         LDKInvoiceError obj_conv;
54201         obj_conv.inner = untag_ptr(obj);
54202         obj_conv.is_owned = ptr_is_owned(obj);
54203         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54204         obj_conv.is_owned = false;
54205         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
54206         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54207         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54208         CVec_u8Z_free(ret_var);
54209         return ret_arr;
54210 }
54211
54212 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
54213         LDKu8slice ser_ref;
54214         ser_ref.datalen = ser->arr_len;
54215         ser_ref.data = ser->elems;
54216         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
54217         *ret_conv = InvoiceError_read(ser_ref);
54218         FREE(ser);
54219         return tag_ptr(ret_conv, true);
54220 }
54221
54222 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
54223         LDKUnsignedInvoiceRequest this_obj_conv;
54224         this_obj_conv.inner = untag_ptr(this_obj);
54225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54227         UnsignedInvoiceRequest_free(this_obj_conv);
54228 }
54229
54230 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
54231         LDKUnsignedInvoiceRequest this_arg_conv;
54232         this_arg_conv.inner = untag_ptr(this_arg);
54233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54235         this_arg_conv.is_owned = false;
54236         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
54237         uint64_t ret_ref = 0;
54238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54240         return ret_ref;
54241 }
54242
54243 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
54244         LDKInvoiceRequest this_obj_conv;
54245         this_obj_conv.inner = untag_ptr(this_obj);
54246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54248         InvoiceRequest_free(this_obj_conv);
54249 }
54250
54251 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
54252         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
54253         uint64_t ret_ref = 0;
54254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54256         return ret_ref;
54257 }
54258 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
54259         LDKInvoiceRequest arg_conv;
54260         arg_conv.inner = untag_ptr(arg);
54261         arg_conv.is_owned = ptr_is_owned(arg);
54262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54263         arg_conv.is_owned = false;
54264         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
54265         return ret_conv;
54266 }
54267
54268 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
54269         LDKInvoiceRequest orig_conv;
54270         orig_conv.inner = untag_ptr(orig);
54271         orig_conv.is_owned = ptr_is_owned(orig);
54272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54273         orig_conv.is_owned = false;
54274         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
54275         uint64_t ret_ref = 0;
54276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54278         return ret_ref;
54279 }
54280
54281 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
54282         LDKVerifiedInvoiceRequest this_obj_conv;
54283         this_obj_conv.inner = untag_ptr(this_obj);
54284         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54286         VerifiedInvoiceRequest_free(this_obj_conv);
54287 }
54288
54289 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
54290         LDKVerifiedInvoiceRequest this_ptr_conv;
54291         this_ptr_conv.inner = untag_ptr(this_ptr);
54292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54294         this_ptr_conv.is_owned = false;
54295         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
54296         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
54297         uint64_t ret_ref = tag_ptr(ret_copy, true);
54298         return ret_ref;
54299 }
54300
54301 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
54302         LDKVerifiedInvoiceRequest this_ptr_conv;
54303         this_ptr_conv.inner = untag_ptr(this_ptr);
54304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54306         this_ptr_conv.is_owned = false;
54307         void* val_ptr = untag_ptr(val);
54308         CHECK_ACCESS(val_ptr);
54309         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
54310         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
54311         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
54312 }
54313
54314 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
54315         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
54316         uint64_t ret_ref = 0;
54317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54319         return ret_ref;
54320 }
54321 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
54322         LDKVerifiedInvoiceRequest arg_conv;
54323         arg_conv.inner = untag_ptr(arg);
54324         arg_conv.is_owned = ptr_is_owned(arg);
54325         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54326         arg_conv.is_owned = false;
54327         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
54328         return ret_conv;
54329 }
54330
54331 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
54332         LDKVerifiedInvoiceRequest orig_conv;
54333         orig_conv.inner = untag_ptr(orig);
54334         orig_conv.is_owned = ptr_is_owned(orig);
54335         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54336         orig_conv.is_owned = false;
54337         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
54338         uint64_t ret_ref = 0;
54339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54341         return ret_ref;
54342 }
54343
54344 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
54345         LDKUnsignedInvoiceRequest this_arg_conv;
54346         this_arg_conv.inner = untag_ptr(this_arg);
54347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54349         this_arg_conv.is_owned = false;
54350         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
54351         ptrArray ret_arr = NULL;
54352         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54353         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54354         for (size_t m = 0; m < ret_var.datalen; m++) {
54355                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
54356                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
54357                 ret_arr_ptr[m] = ret_conv_12_arr;
54358         }
54359         
54360         FREE(ret_var.data);
54361         return ret_arr;
54362 }
54363
54364 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
54365         LDKUnsignedInvoiceRequest this_arg_conv;
54366         this_arg_conv.inner = untag_ptr(this_arg);
54367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54369         this_arg_conv.is_owned = false;
54370         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54371         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
54372         uint64_t ret_ref = tag_ptr(ret_copy, true);
54373         return ret_ref;
54374 }
54375
54376 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
54377         LDKUnsignedInvoiceRequest this_arg_conv;
54378         this_arg_conv.inner = untag_ptr(this_arg);
54379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54381         this_arg_conv.is_owned = false;
54382         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
54383         uint64_t ret_ref = 0;
54384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54386         return ret_ref;
54387 }
54388
54389 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
54390         LDKUnsignedInvoiceRequest this_arg_conv;
54391         this_arg_conv.inner = untag_ptr(this_arg);
54392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54394         this_arg_conv.is_owned = false;
54395         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
54396         uint64_t ret_ref = 0;
54397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54399         return ret_ref;
54400 }
54401
54402 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
54403         LDKUnsignedInvoiceRequest this_arg_conv;
54404         this_arg_conv.inner = untag_ptr(this_arg);
54405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54407         this_arg_conv.is_owned = false;
54408         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
54409         uint64_t ret_ref = 0;
54410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54412         return ret_ref;
54413 }
54414
54415 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
54416         LDKUnsignedInvoiceRequest this_arg_conv;
54417         this_arg_conv.inner = untag_ptr(this_arg);
54418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54420         this_arg_conv.is_owned = false;
54421         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54422         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
54423         uint64_t ret_ref = tag_ptr(ret_copy, true);
54424         return ret_ref;
54425 }
54426
54427 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
54428         LDKUnsignedInvoiceRequest this_arg_conv;
54429         this_arg_conv.inner = untag_ptr(this_arg);
54430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54432         this_arg_conv.is_owned = false;
54433         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
54434         uint64_t ret_ref = 0;
54435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54437         return ret_ref;
54438 }
54439
54440 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
54441         LDKUnsignedInvoiceRequest this_arg_conv;
54442         this_arg_conv.inner = untag_ptr(this_arg);
54443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54445         this_arg_conv.is_owned = false;
54446         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
54447         uint64_tArray ret_arr = NULL;
54448         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54449         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54450         for (size_t n = 0; n < ret_var.datalen; n++) {
54451                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
54452                 uint64_t ret_conv_13_ref = 0;
54453                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
54454                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
54455                 ret_arr_ptr[n] = ret_conv_13_ref;
54456         }
54457         
54458         FREE(ret_var.data);
54459         return ret_arr;
54460 }
54461
54462 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
54463         LDKUnsignedInvoiceRequest this_arg_conv;
54464         this_arg_conv.inner = untag_ptr(this_arg);
54465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54467         this_arg_conv.is_owned = false;
54468         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
54469         uint64_t ret_ref = 0;
54470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54472         return ret_ref;
54473 }
54474
54475 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
54476         LDKUnsignedInvoiceRequest this_arg_conv;
54477         this_arg_conv.inner = untag_ptr(this_arg);
54478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54480         this_arg_conv.is_owned = false;
54481         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54482         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
54483         return ret_arr;
54484 }
54485
54486 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
54487         LDKUnsignedInvoiceRequest this_arg_conv;
54488         this_arg_conv.inner = untag_ptr(this_arg);
54489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54491         this_arg_conv.is_owned = false;
54492         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
54493         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54494         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54495         return ret_arr;
54496 }
54497
54498 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
54499         LDKUnsignedInvoiceRequest this_arg_conv;
54500         this_arg_conv.inner = untag_ptr(this_arg);
54501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54503         this_arg_conv.is_owned = false;
54504         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54505         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
54506         return ret_arr;
54507 }
54508
54509 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
54510         LDKUnsignedInvoiceRequest this_arg_conv;
54511         this_arg_conv.inner = untag_ptr(this_arg);
54512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54514         this_arg_conv.is_owned = false;
54515         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54516         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
54517         uint64_t ret_ref = tag_ptr(ret_copy, true);
54518         return ret_ref;
54519 }
54520
54521 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
54522         LDKUnsignedInvoiceRequest this_arg_conv;
54523         this_arg_conv.inner = untag_ptr(this_arg);
54524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54526         this_arg_conv.is_owned = false;
54527         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
54528         uint64_t ret_ref = 0;
54529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54531         return ret_ref;
54532 }
54533
54534 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
54535         LDKUnsignedInvoiceRequest this_arg_conv;
54536         this_arg_conv.inner = untag_ptr(this_arg);
54537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54539         this_arg_conv.is_owned = false;
54540         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54541         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
54542         uint64_t ret_ref = tag_ptr(ret_copy, true);
54543         return ret_ref;
54544 }
54545
54546 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
54547         LDKUnsignedInvoiceRequest this_arg_conv;
54548         this_arg_conv.inner = untag_ptr(this_arg);
54549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54551         this_arg_conv.is_owned = false;
54552         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54553         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
54554         return ret_arr;
54555 }
54556
54557 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
54558         LDKUnsignedInvoiceRequest this_arg_conv;
54559         this_arg_conv.inner = untag_ptr(this_arg);
54560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54562         this_arg_conv.is_owned = false;
54563         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
54564         uint64_t ret_ref = 0;
54565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54567         return ret_ref;
54568 }
54569
54570 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
54571         LDKInvoiceRequest this_arg_conv;
54572         this_arg_conv.inner = untag_ptr(this_arg);
54573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54575         this_arg_conv.is_owned = false;
54576         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
54577         ptrArray ret_arr = NULL;
54578         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54579         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54580         for (size_t m = 0; m < ret_var.datalen; m++) {
54581                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
54582                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
54583                 ret_arr_ptr[m] = ret_conv_12_arr;
54584         }
54585         
54586         FREE(ret_var.data);
54587         return ret_arr;
54588 }
54589
54590 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
54591         LDKInvoiceRequest this_arg_conv;
54592         this_arg_conv.inner = untag_ptr(this_arg);
54593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54595         this_arg_conv.is_owned = false;
54596         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54597         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
54598         uint64_t ret_ref = tag_ptr(ret_copy, true);
54599         return ret_ref;
54600 }
54601
54602 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
54603         LDKInvoiceRequest this_arg_conv;
54604         this_arg_conv.inner = untag_ptr(this_arg);
54605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54607         this_arg_conv.is_owned = false;
54608         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
54609         uint64_t ret_ref = 0;
54610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54612         return ret_ref;
54613 }
54614
54615 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
54616         LDKInvoiceRequest this_arg_conv;
54617         this_arg_conv.inner = untag_ptr(this_arg);
54618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54620         this_arg_conv.is_owned = false;
54621         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
54622         uint64_t ret_ref = 0;
54623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54625         return ret_ref;
54626 }
54627
54628 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
54629         LDKInvoiceRequest this_arg_conv;
54630         this_arg_conv.inner = untag_ptr(this_arg);
54631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54633         this_arg_conv.is_owned = false;
54634         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
54635         uint64_t ret_ref = 0;
54636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54638         return ret_ref;
54639 }
54640
54641 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
54642         LDKInvoiceRequest this_arg_conv;
54643         this_arg_conv.inner = untag_ptr(this_arg);
54644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54646         this_arg_conv.is_owned = false;
54647         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54648         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
54649         uint64_t ret_ref = tag_ptr(ret_copy, true);
54650         return ret_ref;
54651 }
54652
54653 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
54654         LDKInvoiceRequest this_arg_conv;
54655         this_arg_conv.inner = untag_ptr(this_arg);
54656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54658         this_arg_conv.is_owned = false;
54659         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
54660         uint64_t ret_ref = 0;
54661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54663         return ret_ref;
54664 }
54665
54666 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
54667         LDKInvoiceRequest this_arg_conv;
54668         this_arg_conv.inner = untag_ptr(this_arg);
54669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54671         this_arg_conv.is_owned = false;
54672         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
54673         uint64_tArray ret_arr = NULL;
54674         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54675         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54676         for (size_t n = 0; n < ret_var.datalen; n++) {
54677                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
54678                 uint64_t ret_conv_13_ref = 0;
54679                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
54680                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
54681                 ret_arr_ptr[n] = ret_conv_13_ref;
54682         }
54683         
54684         FREE(ret_var.data);
54685         return ret_arr;
54686 }
54687
54688 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
54689         LDKInvoiceRequest this_arg_conv;
54690         this_arg_conv.inner = untag_ptr(this_arg);
54691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54693         this_arg_conv.is_owned = false;
54694         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
54695         uint64_t ret_ref = 0;
54696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54698         return ret_ref;
54699 }
54700
54701 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
54702         LDKInvoiceRequest this_arg_conv;
54703         this_arg_conv.inner = untag_ptr(this_arg);
54704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54706         this_arg_conv.is_owned = false;
54707         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54708         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
54709         return ret_arr;
54710 }
54711
54712 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
54713         LDKInvoiceRequest this_arg_conv;
54714         this_arg_conv.inner = untag_ptr(this_arg);
54715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54717         this_arg_conv.is_owned = false;
54718         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
54719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54721         return ret_arr;
54722 }
54723
54724 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
54725         LDKInvoiceRequest this_arg_conv;
54726         this_arg_conv.inner = untag_ptr(this_arg);
54727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54729         this_arg_conv.is_owned = false;
54730         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54731         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
54732         return ret_arr;
54733 }
54734
54735 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
54736         LDKInvoiceRequest this_arg_conv;
54737         this_arg_conv.inner = untag_ptr(this_arg);
54738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54740         this_arg_conv.is_owned = false;
54741         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54742         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
54743         uint64_t ret_ref = tag_ptr(ret_copy, true);
54744         return ret_ref;
54745 }
54746
54747 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
54748         LDKInvoiceRequest this_arg_conv;
54749         this_arg_conv.inner = untag_ptr(this_arg);
54750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54752         this_arg_conv.is_owned = false;
54753         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
54754         uint64_t ret_ref = 0;
54755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54757         return ret_ref;
54758 }
54759
54760 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
54761         LDKInvoiceRequest this_arg_conv;
54762         this_arg_conv.inner = untag_ptr(this_arg);
54763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54765         this_arg_conv.is_owned = false;
54766         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54767         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
54768         uint64_t ret_ref = tag_ptr(ret_copy, true);
54769         return ret_ref;
54770 }
54771
54772 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
54773         LDKInvoiceRequest this_arg_conv;
54774         this_arg_conv.inner = untag_ptr(this_arg);
54775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54777         this_arg_conv.is_owned = false;
54778         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54779         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
54780         return ret_arr;
54781 }
54782
54783 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
54784         LDKInvoiceRequest this_arg_conv;
54785         this_arg_conv.inner = untag_ptr(this_arg);
54786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54788         this_arg_conv.is_owned = false;
54789         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
54790         uint64_t ret_ref = 0;
54791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54793         return ret_ref;
54794 }
54795
54796 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
54797         LDKInvoiceRequest this_arg_conv;
54798         this_arg_conv.inner = untag_ptr(this_arg);
54799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54801         this_arg_conv.is_owned = false;
54802         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54803         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
54804         return ret_arr;
54805 }
54806
54807 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
54808         LDKInvoiceRequest this_arg_conv;
54809         this_arg_conv.inner = untag_ptr(this_arg);
54810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54812         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
54813         LDKExpandedKey key_conv;
54814         key_conv.inner = untag_ptr(key);
54815         key_conv.is_owned = ptr_is_owned(key);
54816         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
54817         key_conv.is_owned = false;
54818         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
54819         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
54820         return tag_ptr(ret_conv, true);
54821 }
54822
54823 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
54824         LDKVerifiedInvoiceRequest this_arg_conv;
54825         this_arg_conv.inner = untag_ptr(this_arg);
54826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54828         this_arg_conv.is_owned = false;
54829         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
54830         ptrArray ret_arr = NULL;
54831         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54832         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54833         for (size_t m = 0; m < ret_var.datalen; m++) {
54834                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
54835                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
54836                 ret_arr_ptr[m] = ret_conv_12_arr;
54837         }
54838         
54839         FREE(ret_var.data);
54840         return ret_arr;
54841 }
54842
54843 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
54844         LDKVerifiedInvoiceRequest this_arg_conv;
54845         this_arg_conv.inner = untag_ptr(this_arg);
54846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54848         this_arg_conv.is_owned = false;
54849         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54850         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
54851         uint64_t ret_ref = tag_ptr(ret_copy, true);
54852         return ret_ref;
54853 }
54854
54855 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
54856         LDKVerifiedInvoiceRequest this_arg_conv;
54857         this_arg_conv.inner = untag_ptr(this_arg);
54858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54860         this_arg_conv.is_owned = false;
54861         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
54862         uint64_t ret_ref = 0;
54863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54865         return ret_ref;
54866 }
54867
54868 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
54869         LDKVerifiedInvoiceRequest this_arg_conv;
54870         this_arg_conv.inner = untag_ptr(this_arg);
54871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54873         this_arg_conv.is_owned = false;
54874         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
54875         uint64_t ret_ref = 0;
54876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54878         return ret_ref;
54879 }
54880
54881 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
54882         LDKVerifiedInvoiceRequest this_arg_conv;
54883         this_arg_conv.inner = untag_ptr(this_arg);
54884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54886         this_arg_conv.is_owned = false;
54887         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
54888         uint64_t ret_ref = 0;
54889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54891         return ret_ref;
54892 }
54893
54894 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
54895         LDKVerifiedInvoiceRequest this_arg_conv;
54896         this_arg_conv.inner = untag_ptr(this_arg);
54897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54899         this_arg_conv.is_owned = false;
54900         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54901         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
54902         uint64_t ret_ref = tag_ptr(ret_copy, true);
54903         return ret_ref;
54904 }
54905
54906 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
54907         LDKVerifiedInvoiceRequest this_arg_conv;
54908         this_arg_conv.inner = untag_ptr(this_arg);
54909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54911         this_arg_conv.is_owned = false;
54912         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
54913         uint64_t ret_ref = 0;
54914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54916         return ret_ref;
54917 }
54918
54919 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
54920         LDKVerifiedInvoiceRequest this_arg_conv;
54921         this_arg_conv.inner = untag_ptr(this_arg);
54922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54924         this_arg_conv.is_owned = false;
54925         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
54926         uint64_tArray ret_arr = NULL;
54927         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54928         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54929         for (size_t n = 0; n < ret_var.datalen; n++) {
54930                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
54931                 uint64_t ret_conv_13_ref = 0;
54932                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
54933                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
54934                 ret_arr_ptr[n] = ret_conv_13_ref;
54935         }
54936         
54937         FREE(ret_var.data);
54938         return ret_arr;
54939 }
54940
54941 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
54942         LDKVerifiedInvoiceRequest this_arg_conv;
54943         this_arg_conv.inner = untag_ptr(this_arg);
54944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54946         this_arg_conv.is_owned = false;
54947         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
54948         uint64_t ret_ref = 0;
54949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54951         return ret_ref;
54952 }
54953
54954 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
54955         LDKVerifiedInvoiceRequest this_arg_conv;
54956         this_arg_conv.inner = untag_ptr(this_arg);
54957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54959         this_arg_conv.is_owned = false;
54960         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54961         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
54962         return ret_arr;
54963 }
54964
54965 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
54966         LDKVerifiedInvoiceRequest this_arg_conv;
54967         this_arg_conv.inner = untag_ptr(this_arg);
54968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54970         this_arg_conv.is_owned = false;
54971         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
54972         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54973         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54974         return ret_arr;
54975 }
54976
54977 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
54978         LDKVerifiedInvoiceRequest this_arg_conv;
54979         this_arg_conv.inner = untag_ptr(this_arg);
54980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54982         this_arg_conv.is_owned = false;
54983         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54984         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
54985         return ret_arr;
54986 }
54987
54988 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
54989         LDKVerifiedInvoiceRequest this_arg_conv;
54990         this_arg_conv.inner = untag_ptr(this_arg);
54991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54993         this_arg_conv.is_owned = false;
54994         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54995         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
54996         uint64_t ret_ref = tag_ptr(ret_copy, true);
54997         return ret_ref;
54998 }
54999
55000 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
55001         LDKVerifiedInvoiceRequest this_arg_conv;
55002         this_arg_conv.inner = untag_ptr(this_arg);
55003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55005         this_arg_conv.is_owned = false;
55006         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
55007         uint64_t ret_ref = 0;
55008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55010         return ret_ref;
55011 }
55012
55013 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
55014         LDKVerifiedInvoiceRequest this_arg_conv;
55015         this_arg_conv.inner = untag_ptr(this_arg);
55016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55018         this_arg_conv.is_owned = false;
55019         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55020         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
55021         uint64_t ret_ref = tag_ptr(ret_copy, true);
55022         return ret_ref;
55023 }
55024
55025 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
55026         LDKVerifiedInvoiceRequest this_arg_conv;
55027         this_arg_conv.inner = untag_ptr(this_arg);
55028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55030         this_arg_conv.is_owned = false;
55031         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55032         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
55033         return ret_arr;
55034 }
55035
55036 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
55037         LDKVerifiedInvoiceRequest this_arg_conv;
55038         this_arg_conv.inner = untag_ptr(this_arg);
55039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55041         this_arg_conv.is_owned = false;
55042         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
55043         uint64_t ret_ref = 0;
55044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55046         return ret_ref;
55047 }
55048
55049 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
55050         LDKUnsignedInvoiceRequest obj_conv;
55051         obj_conv.inner = untag_ptr(obj);
55052         obj_conv.is_owned = ptr_is_owned(obj);
55053         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55054         obj_conv.is_owned = false;
55055         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
55056         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55057         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55058         CVec_u8Z_free(ret_var);
55059         return ret_arr;
55060 }
55061
55062 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
55063         LDKInvoiceRequest obj_conv;
55064         obj_conv.inner = untag_ptr(obj);
55065         obj_conv.is_owned = ptr_is_owned(obj);
55066         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55067         obj_conv.is_owned = false;
55068         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
55069         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55070         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55071         CVec_u8Z_free(ret_var);
55072         return ret_arr;
55073 }
55074
55075 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
55076         LDKTaggedHash this_obj_conv;
55077         this_obj_conv.inner = untag_ptr(this_obj);
55078         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55080         TaggedHash_free(this_obj_conv);
55081 }
55082
55083 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
55084         LDKBolt12ParseError this_obj_conv;
55085         this_obj_conv.inner = untag_ptr(this_obj);
55086         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55088         Bolt12ParseError_free(this_obj_conv);
55089 }
55090
55091 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
55092         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
55093         uint64_t ret_ref = 0;
55094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55096         return ret_ref;
55097 }
55098 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
55099         LDKBolt12ParseError arg_conv;
55100         arg_conv.inner = untag_ptr(arg);
55101         arg_conv.is_owned = ptr_is_owned(arg);
55102         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55103         arg_conv.is_owned = false;
55104         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
55105         return ret_conv;
55106 }
55107
55108 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
55109         LDKBolt12ParseError orig_conv;
55110         orig_conv.inner = untag_ptr(orig);
55111         orig_conv.is_owned = ptr_is_owned(orig);
55112         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55113         orig_conv.is_owned = false;
55114         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
55115         uint64_t ret_ref = 0;
55116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55118         return ret_ref;
55119 }
55120
55121 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
55122         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
55123         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
55124         return ret_conv;
55125 }
55126
55127 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
55128         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
55129         return ret_conv;
55130 }
55131
55132 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
55133         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
55134         return ret_conv;
55135 }
55136
55137 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
55138         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
55139         return ret_conv;
55140 }
55141
55142 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
55143         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
55144         return ret_conv;
55145 }
55146
55147 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
55148         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
55149         return ret_conv;
55150 }
55151
55152 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
55153         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
55154         return ret_conv;
55155 }
55156
55157 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
55158         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
55159         return ret_conv;
55160 }
55161
55162 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
55163         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
55164         return ret_conv;
55165 }
55166
55167 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
55168         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
55169         return ret_conv;
55170 }
55171
55172 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
55173         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
55174         return ret_conv;
55175 }
55176
55177 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
55178         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
55179         return ret_conv;
55180 }
55181
55182 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
55183         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
55184         return ret_conv;
55185 }
55186
55187 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
55188         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
55189         return ret_conv;
55190 }
55191
55192 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
55193         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
55194         return ret_conv;
55195 }
55196
55197 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
55198         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
55199         return ret_conv;
55200 }
55201
55202 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
55203         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
55204         return ret_conv;
55205 }
55206
55207 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
55208         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
55209         return ret_conv;
55210 }
55211
55212 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
55213         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
55214         return ret_conv;
55215 }
55216
55217 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
55218         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
55219         return ret_conv;
55220 }
55221
55222 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
55223         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
55224         return ret_conv;
55225 }
55226
55227 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
55228         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
55229         return ret_conv;
55230 }
55231
55232 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
55233         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
55234         return ret_conv;
55235 }
55236
55237 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
55238         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
55239         return ret_conv;
55240 }
55241
55242 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
55243         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
55244         return ret_conv;
55245 }
55246
55247 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
55248         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
55249         return ret_conv;
55250 }
55251
55252 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
55253         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
55254         return ret_conv;
55255 }
55256
55257 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
55258         LDKRefund this_obj_conv;
55259         this_obj_conv.inner = untag_ptr(this_obj);
55260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55262         Refund_free(this_obj_conv);
55263 }
55264
55265 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
55266         LDKRefund ret_var = Refund_clone(arg);
55267         uint64_t ret_ref = 0;
55268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55270         return ret_ref;
55271 }
55272 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
55273         LDKRefund arg_conv;
55274         arg_conv.inner = untag_ptr(arg);
55275         arg_conv.is_owned = ptr_is_owned(arg);
55276         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55277         arg_conv.is_owned = false;
55278         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
55279         return ret_conv;
55280 }
55281
55282 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
55283         LDKRefund orig_conv;
55284         orig_conv.inner = untag_ptr(orig);
55285         orig_conv.is_owned = ptr_is_owned(orig);
55286         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55287         orig_conv.is_owned = false;
55288         LDKRefund ret_var = Refund_clone(&orig_conv);
55289         uint64_t ret_ref = 0;
55290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55292         return ret_ref;
55293 }
55294
55295 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
55296         LDKRefund this_arg_conv;
55297         this_arg_conv.inner = untag_ptr(this_arg);
55298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55300         this_arg_conv.is_owned = false;
55301         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
55302         uint64_t ret_ref = 0;
55303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55305         return ret_ref;
55306 }
55307
55308 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
55309         LDKRefund this_arg_conv;
55310         this_arg_conv.inner = untag_ptr(this_arg);
55311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55313         this_arg_conv.is_owned = false;
55314         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55315         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
55316         uint64_t ret_ref = tag_ptr(ret_copy, true);
55317         return ret_ref;
55318 }
55319
55320 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
55321         LDKRefund this_arg_conv;
55322         this_arg_conv.inner = untag_ptr(this_arg);
55323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55325         this_arg_conv.is_owned = false;
55326         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
55327         uint64_t ret_ref = 0;
55328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55330         return ret_ref;
55331 }
55332
55333 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
55334         LDKRefund this_arg_conv;
55335         this_arg_conv.inner = untag_ptr(this_arg);
55336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55338         this_arg_conv.is_owned = false;
55339         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
55340         uint64_tArray ret_arr = NULL;
55341         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55342         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55343         for (size_t n = 0; n < ret_var.datalen; n++) {
55344                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55345                 uint64_t ret_conv_13_ref = 0;
55346                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55347                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55348                 ret_arr_ptr[n] = ret_conv_13_ref;
55349         }
55350         
55351         FREE(ret_var.data);
55352         return ret_arr;
55353 }
55354
55355 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
55356         LDKRefund this_arg_conv;
55357         this_arg_conv.inner = untag_ptr(this_arg);
55358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55360         this_arg_conv.is_owned = false;
55361         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
55362         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55363         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55364         return ret_arr;
55365 }
55366
55367 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
55368         LDKRefund this_arg_conv;
55369         this_arg_conv.inner = untag_ptr(this_arg);
55370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55372         this_arg_conv.is_owned = false;
55373         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55374         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
55375         return ret_arr;
55376 }
55377
55378 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
55379         LDKRefund this_arg_conv;
55380         this_arg_conv.inner = untag_ptr(this_arg);
55381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55383         this_arg_conv.is_owned = false;
55384         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
55385         return ret_conv;
55386 }
55387
55388 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
55389         LDKRefund this_arg_conv;
55390         this_arg_conv.inner = untag_ptr(this_arg);
55391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55393         this_arg_conv.is_owned = false;
55394         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
55395         uint64_t ret_ref = 0;
55396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55398         return ret_ref;
55399 }
55400
55401 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
55402         LDKRefund this_arg_conv;
55403         this_arg_conv.inner = untag_ptr(this_arg);
55404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55406         this_arg_conv.is_owned = false;
55407         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55408         *ret_copy = Refund_quantity(&this_arg_conv);
55409         uint64_t ret_ref = tag_ptr(ret_copy, true);
55410         return ret_ref;
55411 }
55412
55413 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
55414         LDKRefund this_arg_conv;
55415         this_arg_conv.inner = untag_ptr(this_arg);
55416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55418         this_arg_conv.is_owned = false;
55419         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55420         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
55421         return ret_arr;
55422 }
55423
55424 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
55425         LDKRefund this_arg_conv;
55426         this_arg_conv.inner = untag_ptr(this_arg);
55427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55429         this_arg_conv.is_owned = false;
55430         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
55431         uint64_t ret_ref = 0;
55432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55434         return ret_ref;
55435 }
55436
55437 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
55438         LDKRefund obj_conv;
55439         obj_conv.inner = untag_ptr(obj);
55440         obj_conv.is_owned = ptr_is_owned(obj);
55441         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55442         obj_conv.is_owned = false;
55443         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
55444         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55445         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55446         CVec_u8Z_free(ret_var);
55447         return ret_arr;
55448 }
55449
55450 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
55451         LDKStr s_conv = str_ref_to_owned_c(s);
55452         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
55453         *ret_conv = Refund_from_str(s_conv);
55454         return tag_ptr(ret_conv, true);
55455 }
55456
55457 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
55458         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
55459         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
55460         return ret_conv;
55461 }
55462
55463 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
55464         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
55465         return ret_conv;
55466 }
55467
55468 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
55469         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
55470         return ret_conv;
55471 }
55472
55473 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
55474         if (!ptr_is_owned(this_ptr)) return;
55475         void* this_ptr_ptr = untag_ptr(this_ptr);
55476         CHECK_ACCESS(this_ptr_ptr);
55477         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
55478         FREE(untag_ptr(this_ptr));
55479         UtxoResult_free(this_ptr_conv);
55480 }
55481
55482 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
55483         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
55484         *ret_copy = UtxoResult_clone(arg);
55485         uint64_t ret_ref = tag_ptr(ret_copy, true);
55486         return ret_ref;
55487 }
55488 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
55489         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
55490         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
55491         return ret_conv;
55492 }
55493
55494 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
55495         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
55496         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
55497         *ret_copy = UtxoResult_clone(orig_conv);
55498         uint64_t ret_ref = tag_ptr(ret_copy, true);
55499         return ret_ref;
55500 }
55501
55502 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
55503         void* a_ptr = untag_ptr(a);
55504         CHECK_ACCESS(a_ptr);
55505         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
55506         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
55507         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
55508         *ret_copy = UtxoResult_sync(a_conv);
55509         uint64_t ret_ref = tag_ptr(ret_copy, true);
55510         return ret_ref;
55511 }
55512
55513 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
55514         LDKUtxoFuture a_conv;
55515         a_conv.inner = untag_ptr(a);
55516         a_conv.is_owned = ptr_is_owned(a);
55517         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55518         a_conv = UtxoFuture_clone(&a_conv);
55519         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
55520         *ret_copy = UtxoResult_async(a_conv);
55521         uint64_t ret_ref = tag_ptr(ret_copy, true);
55522         return ret_ref;
55523 }
55524
55525 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
55526         if (!ptr_is_owned(this_ptr)) return;
55527         void* this_ptr_ptr = untag_ptr(this_ptr);
55528         CHECK_ACCESS(this_ptr_ptr);
55529         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
55530         FREE(untag_ptr(this_ptr));
55531         UtxoLookup_free(this_ptr_conv);
55532 }
55533
55534 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
55535         LDKUtxoFuture this_obj_conv;
55536         this_obj_conv.inner = untag_ptr(this_obj);
55537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55539         UtxoFuture_free(this_obj_conv);
55540 }
55541
55542 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
55543         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
55544         uint64_t ret_ref = 0;
55545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55547         return ret_ref;
55548 }
55549 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
55550         LDKUtxoFuture arg_conv;
55551         arg_conv.inner = untag_ptr(arg);
55552         arg_conv.is_owned = ptr_is_owned(arg);
55553         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55554         arg_conv.is_owned = false;
55555         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
55556         return ret_conv;
55557 }
55558
55559 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
55560         LDKUtxoFuture orig_conv;
55561         orig_conv.inner = untag_ptr(orig);
55562         orig_conv.is_owned = ptr_is_owned(orig);
55563         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55564         orig_conv.is_owned = false;
55565         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
55566         uint64_t ret_ref = 0;
55567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55569         return ret_ref;
55570 }
55571
55572 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
55573         LDKUtxoFuture ret_var = UtxoFuture_new();
55574         uint64_t ret_ref = 0;
55575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55577         return ret_ref;
55578 }
55579
55580 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
55581         LDKUtxoFuture this_arg_conv;
55582         this_arg_conv.inner = untag_ptr(this_arg);
55583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55585         this_arg_conv.is_owned = false;
55586         LDKNetworkGraph graph_conv;
55587         graph_conv.inner = untag_ptr(graph);
55588         graph_conv.is_owned = ptr_is_owned(graph);
55589         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
55590         graph_conv.is_owned = false;
55591         void* result_ptr = untag_ptr(result);
55592         CHECK_ACCESS(result_ptr);
55593         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
55594         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
55595 }
55596
55597 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
55598         LDKUtxoFuture this_arg_conv;
55599         this_arg_conv.inner = untag_ptr(this_arg);
55600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55602         this_arg_conv.is_owned = false;
55603         LDKNetworkGraph graph_conv;
55604         graph_conv.inner = untag_ptr(graph);
55605         graph_conv.is_owned = ptr_is_owned(graph);
55606         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
55607         graph_conv.is_owned = false;
55608         LDKP2PGossipSync gossip_conv;
55609         gossip_conv.inner = untag_ptr(gossip);
55610         gossip_conv.is_owned = ptr_is_owned(gossip);
55611         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
55612         gossip_conv.is_owned = false;
55613         void* result_ptr = untag_ptr(result);
55614         CHECK_ACCESS(result_ptr);
55615         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
55616         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
55617 }
55618
55619 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
55620         LDKNodeId this_obj_conv;
55621         this_obj_conv.inner = untag_ptr(this_obj);
55622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55624         NodeId_free(this_obj_conv);
55625 }
55626
55627 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
55628         LDKNodeId ret_var = NodeId_clone(arg);
55629         uint64_t ret_ref = 0;
55630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55632         return ret_ref;
55633 }
55634 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
55635         LDKNodeId arg_conv;
55636         arg_conv.inner = untag_ptr(arg);
55637         arg_conv.is_owned = ptr_is_owned(arg);
55638         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55639         arg_conv.is_owned = false;
55640         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
55641         return ret_conv;
55642 }
55643
55644 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
55645         LDKNodeId orig_conv;
55646         orig_conv.inner = untag_ptr(orig);
55647         orig_conv.is_owned = ptr_is_owned(orig);
55648         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55649         orig_conv.is_owned = false;
55650         LDKNodeId ret_var = NodeId_clone(&orig_conv);
55651         uint64_t ret_ref = 0;
55652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55654         return ret_ref;
55655 }
55656
55657 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
55658         LDKPublicKey pubkey_ref;
55659         CHECK(pubkey->arr_len == 33);
55660         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
55661         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
55662         uint64_t ret_ref = 0;
55663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55665         return ret_ref;
55666 }
55667
55668 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
55669         LDKNodeId this_arg_conv;
55670         this_arg_conv.inner = untag_ptr(this_arg);
55671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55673         this_arg_conv.is_owned = false;
55674         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
55675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55677         return ret_arr;
55678 }
55679
55680 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
55681         LDKNodeId this_arg_conv;
55682         this_arg_conv.inner = untag_ptr(this_arg);
55683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55685         this_arg_conv.is_owned = false;
55686         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
55687         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
55688         return tag_ptr(ret_conv, true);
55689 }
55690
55691 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
55692         LDKNodeId o_conv;
55693         o_conv.inner = untag_ptr(o);
55694         o_conv.is_owned = ptr_is_owned(o);
55695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55696         o_conv.is_owned = false;
55697         int64_t ret_conv = NodeId_hash(&o_conv);
55698         return ret_conv;
55699 }
55700
55701 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
55702         LDKNodeId obj_conv;
55703         obj_conv.inner = untag_ptr(obj);
55704         obj_conv.is_owned = ptr_is_owned(obj);
55705         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55706         obj_conv.is_owned = false;
55707         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
55708         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55709         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55710         CVec_u8Z_free(ret_var);
55711         return ret_arr;
55712 }
55713
55714 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
55715         LDKu8slice ser_ref;
55716         ser_ref.datalen = ser->arr_len;
55717         ser_ref.data = ser->elems;
55718         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
55719         *ret_conv = NodeId_read(ser_ref);
55720         FREE(ser);
55721         return tag_ptr(ret_conv, true);
55722 }
55723
55724 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
55725         LDKNetworkGraph this_obj_conv;
55726         this_obj_conv.inner = untag_ptr(this_obj);
55727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55729         NetworkGraph_free(this_obj_conv);
55730 }
55731
55732 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
55733         LDKReadOnlyNetworkGraph this_obj_conv;
55734         this_obj_conv.inner = untag_ptr(this_obj);
55735         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55737         ReadOnlyNetworkGraph_free(this_obj_conv);
55738 }
55739
55740 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
55741         if (!ptr_is_owned(this_ptr)) return;
55742         void* this_ptr_ptr = untag_ptr(this_ptr);
55743         CHECK_ACCESS(this_ptr_ptr);
55744         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
55745         FREE(untag_ptr(this_ptr));
55746         NetworkUpdate_free(this_ptr_conv);
55747 }
55748
55749 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
55750         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55751         *ret_copy = NetworkUpdate_clone(arg);
55752         uint64_t ret_ref = tag_ptr(ret_copy, true);
55753         return ret_ref;
55754 }
55755 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
55756         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
55757         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
55758         return ret_conv;
55759 }
55760
55761 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
55762         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
55763         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55764         *ret_copy = NetworkUpdate_clone(orig_conv);
55765         uint64_t ret_ref = tag_ptr(ret_copy, true);
55766         return ret_ref;
55767 }
55768
55769 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
55770         LDKChannelUpdate msg_conv;
55771         msg_conv.inner = untag_ptr(msg);
55772         msg_conv.is_owned = ptr_is_owned(msg);
55773         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55774         msg_conv = ChannelUpdate_clone(&msg_conv);
55775         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55776         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
55777         uint64_t ret_ref = tag_ptr(ret_copy, true);
55778         return ret_ref;
55779 }
55780
55781 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
55782         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55783         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
55784         uint64_t ret_ref = tag_ptr(ret_copy, true);
55785         return ret_ref;
55786 }
55787
55788 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
55789         LDKPublicKey node_id_ref;
55790         CHECK(node_id->arr_len == 33);
55791         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
55792         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55793         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
55794         uint64_t ret_ref = tag_ptr(ret_copy, true);
55795         return ret_ref;
55796 }
55797
55798 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
55799         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
55800         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
55801         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
55802         return ret_conv;
55803 }
55804
55805 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
55806         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
55807         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
55808         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55809         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55810         CVec_u8Z_free(ret_var);
55811         return ret_arr;
55812 }
55813
55814 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
55815         LDKu8slice ser_ref;
55816         ser_ref.datalen = ser->arr_len;
55817         ser_ref.data = ser->elems;
55818         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
55819         *ret_conv = NetworkUpdate_read(ser_ref);
55820         FREE(ser);
55821         return tag_ptr(ret_conv, true);
55822 }
55823
55824 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
55825         LDKP2PGossipSync this_obj_conv;
55826         this_obj_conv.inner = untag_ptr(this_obj);
55827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55829         P2PGossipSync_free(this_obj_conv);
55830 }
55831
55832 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
55833         LDKNetworkGraph network_graph_conv;
55834         network_graph_conv.inner = untag_ptr(network_graph);
55835         network_graph_conv.is_owned = ptr_is_owned(network_graph);
55836         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
55837         network_graph_conv.is_owned = false;
55838         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
55839         CHECK_ACCESS(utxo_lookup_ptr);
55840         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
55841         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
55842         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
55843                 // Manually implement clone for Java trait instances
55844                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
55845                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55846                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
55847                 }
55848         }
55849         void* logger_ptr = untag_ptr(logger);
55850         CHECK_ACCESS(logger_ptr);
55851         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
55852         if (logger_conv.free == LDKLogger_JCalls_free) {
55853                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55854                 LDKLogger_JCalls_cloned(&logger_conv);
55855         }
55856         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
55857         uint64_t ret_ref = 0;
55858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55860         return ret_ref;
55861 }
55862
55863 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
55864         LDKP2PGossipSync this_arg_conv;
55865         this_arg_conv.inner = untag_ptr(this_arg);
55866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55868         this_arg_conv.is_owned = false;
55869         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
55870         CHECK_ACCESS(utxo_lookup_ptr);
55871         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
55872         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
55873         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
55874                 // Manually implement clone for Java trait instances
55875                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
55876                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55877                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
55878                 }
55879         }
55880         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
55881 }
55882
55883 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
55884         LDKNetworkGraph this_arg_conv;
55885         this_arg_conv.inner = untag_ptr(this_arg);
55886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55888         this_arg_conv.is_owned = false;
55889         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
55890         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
55891 }
55892
55893 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_genesis_hash"))) TS_NetworkGraph_get_genesis_hash(uint64_t this_arg) {
55894         LDKNetworkGraph this_arg_conv;
55895         this_arg_conv.inner = untag_ptr(this_arg);
55896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55898         this_arg_conv.is_owned = false;
55899         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55900         memcpy(ret_arr->elems, NetworkGraph_get_genesis_hash(&this_arg_conv).data, 32);
55901         return ret_arr;
55902 }
55903
55904 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
55905         LDKNodeAnnouncement msg_conv;
55906         msg_conv.inner = untag_ptr(msg);
55907         msg_conv.is_owned = ptr_is_owned(msg);
55908         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55909         msg_conv.is_owned = false;
55910         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
55911         *ret_conv = verify_node_announcement(&msg_conv);
55912         return tag_ptr(ret_conv, true);
55913 }
55914
55915 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
55916         LDKChannelAnnouncement msg_conv;
55917         msg_conv.inner = untag_ptr(msg);
55918         msg_conv.is_owned = ptr_is_owned(msg);
55919         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55920         msg_conv.is_owned = false;
55921         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
55922         *ret_conv = verify_channel_announcement(&msg_conv);
55923         return tag_ptr(ret_conv, true);
55924 }
55925
55926 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
55927         LDKP2PGossipSync this_arg_conv;
55928         this_arg_conv.inner = untag_ptr(this_arg);
55929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55931         this_arg_conv.is_owned = false;
55932         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
55933         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
55934         return tag_ptr(ret_ret, true);
55935 }
55936
55937 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
55938         LDKP2PGossipSync this_arg_conv;
55939         this_arg_conv.inner = untag_ptr(this_arg);
55940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55942         this_arg_conv.is_owned = false;
55943         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
55944         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
55945         return tag_ptr(ret_ret, true);
55946 }
55947
55948 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
55949         LDKChannelUpdateInfo this_obj_conv;
55950         this_obj_conv.inner = untag_ptr(this_obj);
55951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55953         ChannelUpdateInfo_free(this_obj_conv);
55954 }
55955
55956 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
55957         LDKChannelUpdateInfo this_ptr_conv;
55958         this_ptr_conv.inner = untag_ptr(this_ptr);
55959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55961         this_ptr_conv.is_owned = false;
55962         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
55963         return ret_conv;
55964 }
55965
55966 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
55967         LDKChannelUpdateInfo this_ptr_conv;
55968         this_ptr_conv.inner = untag_ptr(this_ptr);
55969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55971         this_ptr_conv.is_owned = false;
55972         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
55973 }
55974
55975 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
55976         LDKChannelUpdateInfo this_ptr_conv;
55977         this_ptr_conv.inner = untag_ptr(this_ptr);
55978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55980         this_ptr_conv.is_owned = false;
55981         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
55982         return ret_conv;
55983 }
55984
55985 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
55986         LDKChannelUpdateInfo this_ptr_conv;
55987         this_ptr_conv.inner = untag_ptr(this_ptr);
55988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55990         this_ptr_conv.is_owned = false;
55991         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
55992 }
55993
55994 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
55995         LDKChannelUpdateInfo this_ptr_conv;
55996         this_ptr_conv.inner = untag_ptr(this_ptr);
55997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55999         this_ptr_conv.is_owned = false;
56000         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
56001         return ret_conv;
56002 }
56003
56004 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
56005         LDKChannelUpdateInfo this_ptr_conv;
56006         this_ptr_conv.inner = untag_ptr(this_ptr);
56007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56009         this_ptr_conv.is_owned = false;
56010         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
56011 }
56012
56013 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
56014         LDKChannelUpdateInfo this_ptr_conv;
56015         this_ptr_conv.inner = untag_ptr(this_ptr);
56016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56018         this_ptr_conv.is_owned = false;
56019         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
56020         return ret_conv;
56021 }
56022
56023 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
56024         LDKChannelUpdateInfo this_ptr_conv;
56025         this_ptr_conv.inner = untag_ptr(this_ptr);
56026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56028         this_ptr_conv.is_owned = false;
56029         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
56030 }
56031
56032 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
56033         LDKChannelUpdateInfo this_ptr_conv;
56034         this_ptr_conv.inner = untag_ptr(this_ptr);
56035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56037         this_ptr_conv.is_owned = false;
56038         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
56039         return ret_conv;
56040 }
56041
56042 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
56043         LDKChannelUpdateInfo this_ptr_conv;
56044         this_ptr_conv.inner = untag_ptr(this_ptr);
56045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56047         this_ptr_conv.is_owned = false;
56048         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
56049 }
56050
56051 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
56052         LDKChannelUpdateInfo this_ptr_conv;
56053         this_ptr_conv.inner = untag_ptr(this_ptr);
56054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56056         this_ptr_conv.is_owned = false;
56057         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
56058         uint64_t ret_ref = 0;
56059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56061         return ret_ref;
56062 }
56063
56064 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
56065         LDKChannelUpdateInfo this_ptr_conv;
56066         this_ptr_conv.inner = untag_ptr(this_ptr);
56067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56069         this_ptr_conv.is_owned = false;
56070         LDKRoutingFees val_conv;
56071         val_conv.inner = untag_ptr(val);
56072         val_conv.is_owned = ptr_is_owned(val);
56073         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56074         val_conv = RoutingFees_clone(&val_conv);
56075         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
56076 }
56077
56078 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
56079         LDKChannelUpdateInfo this_ptr_conv;
56080         this_ptr_conv.inner = untag_ptr(this_ptr);
56081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56083         this_ptr_conv.is_owned = false;
56084         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
56085         uint64_t ret_ref = 0;
56086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56088         return ret_ref;
56089 }
56090
56091 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
56092         LDKChannelUpdateInfo this_ptr_conv;
56093         this_ptr_conv.inner = untag_ptr(this_ptr);
56094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56096         this_ptr_conv.is_owned = false;
56097         LDKChannelUpdate val_conv;
56098         val_conv.inner = untag_ptr(val);
56099         val_conv.is_owned = ptr_is_owned(val);
56100         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56101         val_conv = ChannelUpdate_clone(&val_conv);
56102         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
56103 }
56104
56105 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) {
56106         LDKRoutingFees fees_arg_conv;
56107         fees_arg_conv.inner = untag_ptr(fees_arg);
56108         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
56109         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
56110         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
56111         LDKChannelUpdate last_update_message_arg_conv;
56112         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
56113         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
56114         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
56115         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
56116         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);
56117         uint64_t ret_ref = 0;
56118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56120         return ret_ref;
56121 }
56122
56123 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
56124         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
56125         uint64_t ret_ref = 0;
56126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56128         return ret_ref;
56129 }
56130 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
56131         LDKChannelUpdateInfo arg_conv;
56132         arg_conv.inner = untag_ptr(arg);
56133         arg_conv.is_owned = ptr_is_owned(arg);
56134         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56135         arg_conv.is_owned = false;
56136         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
56137         return ret_conv;
56138 }
56139
56140 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
56141         LDKChannelUpdateInfo orig_conv;
56142         orig_conv.inner = untag_ptr(orig);
56143         orig_conv.is_owned = ptr_is_owned(orig);
56144         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56145         orig_conv.is_owned = false;
56146         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
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
56153 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
56154         LDKChannelUpdateInfo a_conv;
56155         a_conv.inner = untag_ptr(a);
56156         a_conv.is_owned = ptr_is_owned(a);
56157         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56158         a_conv.is_owned = false;
56159         LDKChannelUpdateInfo b_conv;
56160         b_conv.inner = untag_ptr(b);
56161         b_conv.is_owned = ptr_is_owned(b);
56162         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56163         b_conv.is_owned = false;
56164         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
56165         return ret_conv;
56166 }
56167
56168 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
56169         LDKChannelUpdateInfo obj_conv;
56170         obj_conv.inner = untag_ptr(obj);
56171         obj_conv.is_owned = ptr_is_owned(obj);
56172         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56173         obj_conv.is_owned = false;
56174         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
56175         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56176         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56177         CVec_u8Z_free(ret_var);
56178         return ret_arr;
56179 }
56180
56181 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
56182         LDKu8slice ser_ref;
56183         ser_ref.datalen = ser->arr_len;
56184         ser_ref.data = ser->elems;
56185         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
56186         *ret_conv = ChannelUpdateInfo_read(ser_ref);
56187         FREE(ser);
56188         return tag_ptr(ret_conv, true);
56189 }
56190
56191 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
56192         LDKChannelInfo this_obj_conv;
56193         this_obj_conv.inner = untag_ptr(this_obj);
56194         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56196         ChannelInfo_free(this_obj_conv);
56197 }
56198
56199 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
56200         LDKChannelInfo this_ptr_conv;
56201         this_ptr_conv.inner = untag_ptr(this_ptr);
56202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56204         this_ptr_conv.is_owned = false;
56205         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
56206         uint64_t ret_ref = 0;
56207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56209         return ret_ref;
56210 }
56211
56212 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
56213         LDKChannelInfo this_ptr_conv;
56214         this_ptr_conv.inner = untag_ptr(this_ptr);
56215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56217         this_ptr_conv.is_owned = false;
56218         LDKChannelFeatures val_conv;
56219         val_conv.inner = untag_ptr(val);
56220         val_conv.is_owned = ptr_is_owned(val);
56221         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56222         val_conv = ChannelFeatures_clone(&val_conv);
56223         ChannelInfo_set_features(&this_ptr_conv, val_conv);
56224 }
56225
56226 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
56227         LDKChannelInfo this_ptr_conv;
56228         this_ptr_conv.inner = untag_ptr(this_ptr);
56229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56231         this_ptr_conv.is_owned = false;
56232         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
56233         uint64_t ret_ref = 0;
56234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56236         return ret_ref;
56237 }
56238
56239 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
56240         LDKChannelInfo this_ptr_conv;
56241         this_ptr_conv.inner = untag_ptr(this_ptr);
56242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56244         this_ptr_conv.is_owned = false;
56245         LDKNodeId val_conv;
56246         val_conv.inner = untag_ptr(val);
56247         val_conv.is_owned = ptr_is_owned(val);
56248         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56249         val_conv = NodeId_clone(&val_conv);
56250         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
56251 }
56252
56253 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
56254         LDKChannelInfo this_ptr_conv;
56255         this_ptr_conv.inner = untag_ptr(this_ptr);
56256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56258         this_ptr_conv.is_owned = false;
56259         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
56260         uint64_t ret_ref = 0;
56261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56263         return ret_ref;
56264 }
56265
56266 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
56267         LDKChannelInfo this_ptr_conv;
56268         this_ptr_conv.inner = untag_ptr(this_ptr);
56269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56271         this_ptr_conv.is_owned = false;
56272         LDKChannelUpdateInfo val_conv;
56273         val_conv.inner = untag_ptr(val);
56274         val_conv.is_owned = ptr_is_owned(val);
56275         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56276         val_conv = ChannelUpdateInfo_clone(&val_conv);
56277         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
56278 }
56279
56280 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
56281         LDKChannelInfo this_ptr_conv;
56282         this_ptr_conv.inner = untag_ptr(this_ptr);
56283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56285         this_ptr_conv.is_owned = false;
56286         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
56287         uint64_t ret_ref = 0;
56288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56290         return ret_ref;
56291 }
56292
56293 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
56294         LDKChannelInfo this_ptr_conv;
56295         this_ptr_conv.inner = untag_ptr(this_ptr);
56296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56298         this_ptr_conv.is_owned = false;
56299         LDKNodeId val_conv;
56300         val_conv.inner = untag_ptr(val);
56301         val_conv.is_owned = ptr_is_owned(val);
56302         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56303         val_conv = NodeId_clone(&val_conv);
56304         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
56305 }
56306
56307 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
56308         LDKChannelInfo this_ptr_conv;
56309         this_ptr_conv.inner = untag_ptr(this_ptr);
56310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56312         this_ptr_conv.is_owned = false;
56313         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
56314         uint64_t ret_ref = 0;
56315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56317         return ret_ref;
56318 }
56319
56320 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
56321         LDKChannelInfo this_ptr_conv;
56322         this_ptr_conv.inner = untag_ptr(this_ptr);
56323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56325         this_ptr_conv.is_owned = false;
56326         LDKChannelUpdateInfo val_conv;
56327         val_conv.inner = untag_ptr(val);
56328         val_conv.is_owned = ptr_is_owned(val);
56329         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56330         val_conv = ChannelUpdateInfo_clone(&val_conv);
56331         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
56332 }
56333
56334 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
56335         LDKChannelInfo this_ptr_conv;
56336         this_ptr_conv.inner = untag_ptr(this_ptr);
56337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56339         this_ptr_conv.is_owned = false;
56340         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56341         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
56342         uint64_t ret_ref = tag_ptr(ret_copy, true);
56343         return ret_ref;
56344 }
56345
56346 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
56347         LDKChannelInfo this_ptr_conv;
56348         this_ptr_conv.inner = untag_ptr(this_ptr);
56349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56351         this_ptr_conv.is_owned = false;
56352         void* val_ptr = untag_ptr(val);
56353         CHECK_ACCESS(val_ptr);
56354         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
56355         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
56356         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
56357 }
56358
56359 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
56360         LDKChannelInfo this_ptr_conv;
56361         this_ptr_conv.inner = untag_ptr(this_ptr);
56362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56364         this_ptr_conv.is_owned = false;
56365         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
56366         uint64_t ret_ref = 0;
56367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56369         return ret_ref;
56370 }
56371
56372 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
56373         LDKChannelInfo this_ptr_conv;
56374         this_ptr_conv.inner = untag_ptr(this_ptr);
56375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56377         this_ptr_conv.is_owned = false;
56378         LDKChannelAnnouncement val_conv;
56379         val_conv.inner = untag_ptr(val);
56380         val_conv.is_owned = ptr_is_owned(val);
56381         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56382         val_conv = ChannelAnnouncement_clone(&val_conv);
56383         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
56384 }
56385
56386 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
56387         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
56388         uint64_t ret_ref = 0;
56389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56391         return ret_ref;
56392 }
56393 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
56394         LDKChannelInfo arg_conv;
56395         arg_conv.inner = untag_ptr(arg);
56396         arg_conv.is_owned = ptr_is_owned(arg);
56397         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56398         arg_conv.is_owned = false;
56399         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
56400         return ret_conv;
56401 }
56402
56403 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
56404         LDKChannelInfo orig_conv;
56405         orig_conv.inner = untag_ptr(orig);
56406         orig_conv.is_owned = ptr_is_owned(orig);
56407         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56408         orig_conv.is_owned = false;
56409         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
56410         uint64_t ret_ref = 0;
56411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56413         return ret_ref;
56414 }
56415
56416 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
56417         LDKChannelInfo a_conv;
56418         a_conv.inner = untag_ptr(a);
56419         a_conv.is_owned = ptr_is_owned(a);
56420         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56421         a_conv.is_owned = false;
56422         LDKChannelInfo b_conv;
56423         b_conv.inner = untag_ptr(b);
56424         b_conv.is_owned = ptr_is_owned(b);
56425         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56426         b_conv.is_owned = false;
56427         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
56428         return ret_conv;
56429 }
56430
56431 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
56432         LDKChannelInfo this_arg_conv;
56433         this_arg_conv.inner = untag_ptr(this_arg);
56434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56436         this_arg_conv.is_owned = false;
56437         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
56438         uint64_t ret_ref = 0;
56439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56441         return ret_ref;
56442 }
56443
56444 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
56445         LDKChannelInfo obj_conv;
56446         obj_conv.inner = untag_ptr(obj);
56447         obj_conv.is_owned = ptr_is_owned(obj);
56448         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56449         obj_conv.is_owned = false;
56450         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
56451         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56452         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56453         CVec_u8Z_free(ret_var);
56454         return ret_arr;
56455 }
56456
56457 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
56458         LDKu8slice ser_ref;
56459         ser_ref.datalen = ser->arr_len;
56460         ser_ref.data = ser->elems;
56461         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
56462         *ret_conv = ChannelInfo_read(ser_ref);
56463         FREE(ser);
56464         return tag_ptr(ret_conv, true);
56465 }
56466
56467 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
56468         LDKDirectedChannelInfo this_obj_conv;
56469         this_obj_conv.inner = untag_ptr(this_obj);
56470         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56472         DirectedChannelInfo_free(this_obj_conv);
56473 }
56474
56475 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
56476         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
56477         uint64_t ret_ref = 0;
56478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56480         return ret_ref;
56481 }
56482 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
56483         LDKDirectedChannelInfo arg_conv;
56484         arg_conv.inner = untag_ptr(arg);
56485         arg_conv.is_owned = ptr_is_owned(arg);
56486         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56487         arg_conv.is_owned = false;
56488         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
56489         return ret_conv;
56490 }
56491
56492 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
56493         LDKDirectedChannelInfo orig_conv;
56494         orig_conv.inner = untag_ptr(orig);
56495         orig_conv.is_owned = ptr_is_owned(orig);
56496         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56497         orig_conv.is_owned = false;
56498         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
56499         uint64_t ret_ref = 0;
56500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56502         return ret_ref;
56503 }
56504
56505 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
56506         LDKDirectedChannelInfo this_arg_conv;
56507         this_arg_conv.inner = untag_ptr(this_arg);
56508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56510         this_arg_conv.is_owned = false;
56511         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
56512         uint64_t ret_ref = 0;
56513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56515         return ret_ref;
56516 }
56517
56518 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
56519         LDKDirectedChannelInfo this_arg_conv;
56520         this_arg_conv.inner = untag_ptr(this_arg);
56521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56523         this_arg_conv.is_owned = false;
56524         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
56525         return ret_conv;
56526 }
56527
56528 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
56529         LDKDirectedChannelInfo this_arg_conv;
56530         this_arg_conv.inner = untag_ptr(this_arg);
56531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56533         this_arg_conv.is_owned = false;
56534         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56535         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
56536         uint64_t ret_ref = tag_ptr(ret_copy, true);
56537         return ret_ref;
56538 }
56539
56540 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
56541         if (!ptr_is_owned(this_ptr)) return;
56542         void* this_ptr_ptr = untag_ptr(this_ptr);
56543         CHECK_ACCESS(this_ptr_ptr);
56544         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
56545         FREE(untag_ptr(this_ptr));
56546         EffectiveCapacity_free(this_ptr_conv);
56547 }
56548
56549 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
56550         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56551         *ret_copy = EffectiveCapacity_clone(arg);
56552         uint64_t ret_ref = tag_ptr(ret_copy, true);
56553         return ret_ref;
56554 }
56555 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
56556         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
56557         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
56558         return ret_conv;
56559 }
56560
56561 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
56562         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
56563         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56564         *ret_copy = EffectiveCapacity_clone(orig_conv);
56565         uint64_t ret_ref = tag_ptr(ret_copy, true);
56566         return ret_ref;
56567 }
56568
56569 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
56570         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56571         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
56572         uint64_t ret_ref = tag_ptr(ret_copy, true);
56573         return ret_ref;
56574 }
56575
56576 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
56577         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56578         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
56579         uint64_t ret_ref = tag_ptr(ret_copy, true);
56580         return ret_ref;
56581 }
56582
56583 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
56584         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56585         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
56586         uint64_t ret_ref = tag_ptr(ret_copy, true);
56587         return ret_ref;
56588 }
56589
56590 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
56591         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56592         *ret_copy = EffectiveCapacity_infinite();
56593         uint64_t ret_ref = tag_ptr(ret_copy, true);
56594         return ret_ref;
56595 }
56596
56597 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
56598         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56599         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
56600         uint64_t ret_ref = tag_ptr(ret_copy, true);
56601         return ret_ref;
56602 }
56603
56604 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
56605         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56606         *ret_copy = EffectiveCapacity_unknown();
56607         uint64_t ret_ref = tag_ptr(ret_copy, true);
56608         return ret_ref;
56609 }
56610
56611 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
56612         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
56613         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
56614         return ret_conv;
56615 }
56616
56617 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
56618         LDKRoutingFees this_obj_conv;
56619         this_obj_conv.inner = untag_ptr(this_obj);
56620         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56622         RoutingFees_free(this_obj_conv);
56623 }
56624
56625 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
56626         LDKRoutingFees this_ptr_conv;
56627         this_ptr_conv.inner = untag_ptr(this_ptr);
56628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56630         this_ptr_conv.is_owned = false;
56631         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
56632         return ret_conv;
56633 }
56634
56635 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
56636         LDKRoutingFees this_ptr_conv;
56637         this_ptr_conv.inner = untag_ptr(this_ptr);
56638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56640         this_ptr_conv.is_owned = false;
56641         RoutingFees_set_base_msat(&this_ptr_conv, val);
56642 }
56643
56644 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
56645         LDKRoutingFees this_ptr_conv;
56646         this_ptr_conv.inner = untag_ptr(this_ptr);
56647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56649         this_ptr_conv.is_owned = false;
56650         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
56651         return ret_conv;
56652 }
56653
56654 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
56655         LDKRoutingFees this_ptr_conv;
56656         this_ptr_conv.inner = untag_ptr(this_ptr);
56657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56659         this_ptr_conv.is_owned = false;
56660         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
56661 }
56662
56663 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
56664         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
56665         uint64_t ret_ref = 0;
56666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56668         return ret_ref;
56669 }
56670
56671 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
56672         LDKRoutingFees a_conv;
56673         a_conv.inner = untag_ptr(a);
56674         a_conv.is_owned = ptr_is_owned(a);
56675         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56676         a_conv.is_owned = false;
56677         LDKRoutingFees b_conv;
56678         b_conv.inner = untag_ptr(b);
56679         b_conv.is_owned = ptr_is_owned(b);
56680         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56681         b_conv.is_owned = false;
56682         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
56683         return ret_conv;
56684 }
56685
56686 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
56687         LDKRoutingFees ret_var = RoutingFees_clone(arg);
56688         uint64_t ret_ref = 0;
56689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56691         return ret_ref;
56692 }
56693 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
56694         LDKRoutingFees arg_conv;
56695         arg_conv.inner = untag_ptr(arg);
56696         arg_conv.is_owned = ptr_is_owned(arg);
56697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56698         arg_conv.is_owned = false;
56699         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
56700         return ret_conv;
56701 }
56702
56703 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
56704         LDKRoutingFees orig_conv;
56705         orig_conv.inner = untag_ptr(orig);
56706         orig_conv.is_owned = ptr_is_owned(orig);
56707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56708         orig_conv.is_owned = false;
56709         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
56710         uint64_t ret_ref = 0;
56711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56713         return ret_ref;
56714 }
56715
56716 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
56717         LDKRoutingFees o_conv;
56718         o_conv.inner = untag_ptr(o);
56719         o_conv.is_owned = ptr_is_owned(o);
56720         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56721         o_conv.is_owned = false;
56722         int64_t ret_conv = RoutingFees_hash(&o_conv);
56723         return ret_conv;
56724 }
56725
56726 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
56727         LDKRoutingFees obj_conv;
56728         obj_conv.inner = untag_ptr(obj);
56729         obj_conv.is_owned = ptr_is_owned(obj);
56730         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56731         obj_conv.is_owned = false;
56732         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
56733         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56734         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56735         CVec_u8Z_free(ret_var);
56736         return ret_arr;
56737 }
56738
56739 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
56740         LDKu8slice ser_ref;
56741         ser_ref.datalen = ser->arr_len;
56742         ser_ref.data = ser->elems;
56743         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
56744         *ret_conv = RoutingFees_read(ser_ref);
56745         FREE(ser);
56746         return tag_ptr(ret_conv, true);
56747 }
56748
56749 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
56750         LDKNodeAnnouncementInfo this_obj_conv;
56751         this_obj_conv.inner = untag_ptr(this_obj);
56752         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56754         NodeAnnouncementInfo_free(this_obj_conv);
56755 }
56756
56757 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
56758         LDKNodeAnnouncementInfo this_ptr_conv;
56759         this_ptr_conv.inner = untag_ptr(this_ptr);
56760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56762         this_ptr_conv.is_owned = false;
56763         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
56764         uint64_t ret_ref = 0;
56765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56767         return ret_ref;
56768 }
56769
56770 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
56771         LDKNodeAnnouncementInfo this_ptr_conv;
56772         this_ptr_conv.inner = untag_ptr(this_ptr);
56773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56775         this_ptr_conv.is_owned = false;
56776         LDKNodeFeatures val_conv;
56777         val_conv.inner = untag_ptr(val);
56778         val_conv.is_owned = ptr_is_owned(val);
56779         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56780         val_conv = NodeFeatures_clone(&val_conv);
56781         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
56782 }
56783
56784 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
56785         LDKNodeAnnouncementInfo 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         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
56791         return ret_conv;
56792 }
56793
56794 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
56795         LDKNodeAnnouncementInfo this_ptr_conv;
56796         this_ptr_conv.inner = untag_ptr(this_ptr);
56797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56799         this_ptr_conv.is_owned = false;
56800         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
56801 }
56802
56803 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
56804         LDKNodeAnnouncementInfo this_ptr_conv;
56805         this_ptr_conv.inner = untag_ptr(this_ptr);
56806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56808         this_ptr_conv.is_owned = false;
56809         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
56810         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
56811         return ret_arr;
56812 }
56813
56814 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
56815         LDKNodeAnnouncementInfo this_ptr_conv;
56816         this_ptr_conv.inner = untag_ptr(this_ptr);
56817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56819         this_ptr_conv.is_owned = false;
56820         LDKThreeBytes val_ref;
56821         CHECK(val->arr_len == 3);
56822         memcpy(val_ref.data, val->elems, 3); FREE(val);
56823         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
56824 }
56825
56826 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
56827         LDKNodeAnnouncementInfo this_ptr_conv;
56828         this_ptr_conv.inner = untag_ptr(this_ptr);
56829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56831         this_ptr_conv.is_owned = false;
56832         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
56833         uint64_t ret_ref = 0;
56834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56836         return ret_ref;
56837 }
56838
56839 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
56840         LDKNodeAnnouncementInfo this_ptr_conv;
56841         this_ptr_conv.inner = untag_ptr(this_ptr);
56842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56844         this_ptr_conv.is_owned = false;
56845         LDKNodeAlias val_conv;
56846         val_conv.inner = untag_ptr(val);
56847         val_conv.is_owned = ptr_is_owned(val);
56848         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56849         val_conv = NodeAlias_clone(&val_conv);
56850         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
56851 }
56852
56853 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
56854         LDKNodeAnnouncementInfo this_ptr_conv;
56855         this_ptr_conv.inner = untag_ptr(this_ptr);
56856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56858         this_ptr_conv.is_owned = false;
56859         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
56860         uint64_t ret_ref = 0;
56861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56863         return ret_ref;
56864 }
56865
56866 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
56867         LDKNodeAnnouncementInfo this_ptr_conv;
56868         this_ptr_conv.inner = untag_ptr(this_ptr);
56869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56871         this_ptr_conv.is_owned = false;
56872         LDKNodeAnnouncement val_conv;
56873         val_conv.inner = untag_ptr(val);
56874         val_conv.is_owned = ptr_is_owned(val);
56875         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56876         val_conv = NodeAnnouncement_clone(&val_conv);
56877         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
56878 }
56879
56880 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) {
56881         LDKNodeFeatures features_arg_conv;
56882         features_arg_conv.inner = untag_ptr(features_arg);
56883         features_arg_conv.is_owned = ptr_is_owned(features_arg);
56884         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
56885         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
56886         LDKThreeBytes rgb_arg_ref;
56887         CHECK(rgb_arg->arr_len == 3);
56888         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
56889         LDKNodeAlias alias_arg_conv;
56890         alias_arg_conv.inner = untag_ptr(alias_arg);
56891         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
56892         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
56893         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
56894         LDKNodeAnnouncement announcement_message_arg_conv;
56895         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
56896         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
56897         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
56898         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
56899         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
56900         uint64_t ret_ref = 0;
56901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56903         return ret_ref;
56904 }
56905
56906 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
56907         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
56908         uint64_t ret_ref = 0;
56909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56911         return ret_ref;
56912 }
56913 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
56914         LDKNodeAnnouncementInfo arg_conv;
56915         arg_conv.inner = untag_ptr(arg);
56916         arg_conv.is_owned = ptr_is_owned(arg);
56917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56918         arg_conv.is_owned = false;
56919         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
56920         return ret_conv;
56921 }
56922
56923 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
56924         LDKNodeAnnouncementInfo orig_conv;
56925         orig_conv.inner = untag_ptr(orig);
56926         orig_conv.is_owned = ptr_is_owned(orig);
56927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56928         orig_conv.is_owned = false;
56929         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
56930         uint64_t ret_ref = 0;
56931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56933         return ret_ref;
56934 }
56935
56936 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
56937         LDKNodeAnnouncementInfo a_conv;
56938         a_conv.inner = untag_ptr(a);
56939         a_conv.is_owned = ptr_is_owned(a);
56940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56941         a_conv.is_owned = false;
56942         LDKNodeAnnouncementInfo b_conv;
56943         b_conv.inner = untag_ptr(b);
56944         b_conv.is_owned = ptr_is_owned(b);
56945         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56946         b_conv.is_owned = false;
56947         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
56948         return ret_conv;
56949 }
56950
56951 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
56952         LDKNodeAnnouncementInfo this_arg_conv;
56953         this_arg_conv.inner = untag_ptr(this_arg);
56954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56956         this_arg_conv.is_owned = false;
56957         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
56958         uint64_tArray ret_arr = NULL;
56959         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
56960         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
56961         for (size_t p = 0; p < ret_var.datalen; p++) {
56962                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
56963                 *ret_conv_15_copy = ret_var.data[p];
56964                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
56965                 ret_arr_ptr[p] = ret_conv_15_ref;
56966         }
56967         
56968         FREE(ret_var.data);
56969         return ret_arr;
56970 }
56971
56972 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
56973         LDKNodeAnnouncementInfo obj_conv;
56974         obj_conv.inner = untag_ptr(obj);
56975         obj_conv.is_owned = ptr_is_owned(obj);
56976         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56977         obj_conv.is_owned = false;
56978         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
56979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56981         CVec_u8Z_free(ret_var);
56982         return ret_arr;
56983 }
56984
56985 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
56986         LDKu8slice ser_ref;
56987         ser_ref.datalen = ser->arr_len;
56988         ser_ref.data = ser->elems;
56989         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
56990         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
56991         FREE(ser);
56992         return tag_ptr(ret_conv, true);
56993 }
56994
56995 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
56996         LDKNodeAlias this_obj_conv;
56997         this_obj_conv.inner = untag_ptr(this_obj);
56998         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57000         NodeAlias_free(this_obj_conv);
57001 }
57002
57003 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
57004         LDKNodeAlias this_ptr_conv;
57005         this_ptr_conv.inner = untag_ptr(this_ptr);
57006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57008         this_ptr_conv.is_owned = false;
57009         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57010         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
57011         return ret_arr;
57012 }
57013
57014 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
57015         LDKNodeAlias this_ptr_conv;
57016         this_ptr_conv.inner = untag_ptr(this_ptr);
57017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57019         this_ptr_conv.is_owned = false;
57020         LDKThirtyTwoBytes val_ref;
57021         CHECK(val->arr_len == 32);
57022         memcpy(val_ref.data, val->elems, 32); FREE(val);
57023         NodeAlias_set_a(&this_ptr_conv, val_ref);
57024 }
57025
57026 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
57027         LDKThirtyTwoBytes a_arg_ref;
57028         CHECK(a_arg->arr_len == 32);
57029         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
57030         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
57031         uint64_t ret_ref = 0;
57032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57034         return ret_ref;
57035 }
57036
57037 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
57038         LDKNodeAlias ret_var = NodeAlias_clone(arg);
57039         uint64_t ret_ref = 0;
57040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57042         return ret_ref;
57043 }
57044 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
57045         LDKNodeAlias arg_conv;
57046         arg_conv.inner = untag_ptr(arg);
57047         arg_conv.is_owned = ptr_is_owned(arg);
57048         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57049         arg_conv.is_owned = false;
57050         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
57051         return ret_conv;
57052 }
57053
57054 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
57055         LDKNodeAlias orig_conv;
57056         orig_conv.inner = untag_ptr(orig);
57057         orig_conv.is_owned = ptr_is_owned(orig);
57058         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57059         orig_conv.is_owned = false;
57060         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
57061         uint64_t ret_ref = 0;
57062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57064         return ret_ref;
57065 }
57066
57067 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
57068         LDKNodeAlias a_conv;
57069         a_conv.inner = untag_ptr(a);
57070         a_conv.is_owned = ptr_is_owned(a);
57071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57072         a_conv.is_owned = false;
57073         LDKNodeAlias b_conv;
57074         b_conv.inner = untag_ptr(b);
57075         b_conv.is_owned = ptr_is_owned(b);
57076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57077         b_conv.is_owned = false;
57078         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
57079         return ret_conv;
57080 }
57081
57082 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
57083         LDKNodeAlias obj_conv;
57084         obj_conv.inner = untag_ptr(obj);
57085         obj_conv.is_owned = ptr_is_owned(obj);
57086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57087         obj_conv.is_owned = false;
57088         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
57089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57091         CVec_u8Z_free(ret_var);
57092         return ret_arr;
57093 }
57094
57095 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
57096         LDKu8slice ser_ref;
57097         ser_ref.datalen = ser->arr_len;
57098         ser_ref.data = ser->elems;
57099         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
57100         *ret_conv = NodeAlias_read(ser_ref);
57101         FREE(ser);
57102         return tag_ptr(ret_conv, true);
57103 }
57104
57105 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
57106         LDKNodeInfo this_obj_conv;
57107         this_obj_conv.inner = untag_ptr(this_obj);
57108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57110         NodeInfo_free(this_obj_conv);
57111 }
57112
57113 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
57114         LDKNodeInfo this_ptr_conv;
57115         this_ptr_conv.inner = untag_ptr(this_ptr);
57116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57118         this_ptr_conv.is_owned = false;
57119         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
57120         int64_tArray ret_arr = NULL;
57121         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
57122         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
57123         for (size_t i = 0; i < ret_var.datalen; i++) {
57124                 int64_t ret_conv_8_conv = ret_var.data[i];
57125                 ret_arr_ptr[i] = ret_conv_8_conv;
57126         }
57127         
57128         FREE(ret_var.data);
57129         return ret_arr;
57130 }
57131
57132 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
57133         LDKNodeInfo this_ptr_conv;
57134         this_ptr_conv.inner = untag_ptr(this_ptr);
57135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57137         this_ptr_conv.is_owned = false;
57138         LDKCVec_u64Z val_constr;
57139         val_constr.datalen = val->arr_len;
57140         if (val_constr.datalen > 0)
57141                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
57142         else
57143                 val_constr.data = NULL;
57144         int64_t* val_vals = val->elems;
57145         for (size_t i = 0; i < val_constr.datalen; i++) {
57146                 int64_t val_conv_8 = val_vals[i];
57147                 val_constr.data[i] = val_conv_8;
57148         }
57149         FREE(val);
57150         NodeInfo_set_channels(&this_ptr_conv, val_constr);
57151 }
57152
57153 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
57154         LDKNodeInfo this_ptr_conv;
57155         this_ptr_conv.inner = untag_ptr(this_ptr);
57156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57158         this_ptr_conv.is_owned = false;
57159         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
57160         uint64_t ret_ref = 0;
57161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57163         return ret_ref;
57164 }
57165
57166 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
57167         LDKNodeInfo this_ptr_conv;
57168         this_ptr_conv.inner = untag_ptr(this_ptr);
57169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57171         this_ptr_conv.is_owned = false;
57172         LDKNodeAnnouncementInfo val_conv;
57173         val_conv.inner = untag_ptr(val);
57174         val_conv.is_owned = ptr_is_owned(val);
57175         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57176         val_conv = NodeAnnouncementInfo_clone(&val_conv);
57177         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
57178 }
57179
57180 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
57181         LDKCVec_u64Z channels_arg_constr;
57182         channels_arg_constr.datalen = channels_arg->arr_len;
57183         if (channels_arg_constr.datalen > 0)
57184                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
57185         else
57186                 channels_arg_constr.data = NULL;
57187         int64_t* channels_arg_vals = channels_arg->elems;
57188         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
57189                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
57190                 channels_arg_constr.data[i] = channels_arg_conv_8;
57191         }
57192         FREE(channels_arg);
57193         LDKNodeAnnouncementInfo announcement_info_arg_conv;
57194         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
57195         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
57196         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
57197         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
57198         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
57199         uint64_t ret_ref = 0;
57200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57202         return ret_ref;
57203 }
57204
57205 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
57206         LDKNodeInfo ret_var = NodeInfo_clone(arg);
57207         uint64_t ret_ref = 0;
57208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57210         return ret_ref;
57211 }
57212 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
57213         LDKNodeInfo arg_conv;
57214         arg_conv.inner = untag_ptr(arg);
57215         arg_conv.is_owned = ptr_is_owned(arg);
57216         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57217         arg_conv.is_owned = false;
57218         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
57219         return ret_conv;
57220 }
57221
57222 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
57223         LDKNodeInfo orig_conv;
57224         orig_conv.inner = untag_ptr(orig);
57225         orig_conv.is_owned = ptr_is_owned(orig);
57226         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57227         orig_conv.is_owned = false;
57228         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
57229         uint64_t ret_ref = 0;
57230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57232         return ret_ref;
57233 }
57234
57235 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
57236         LDKNodeInfo a_conv;
57237         a_conv.inner = untag_ptr(a);
57238         a_conv.is_owned = ptr_is_owned(a);
57239         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57240         a_conv.is_owned = false;
57241         LDKNodeInfo b_conv;
57242         b_conv.inner = untag_ptr(b);
57243         b_conv.is_owned = ptr_is_owned(b);
57244         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57245         b_conv.is_owned = false;
57246         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
57247         return ret_conv;
57248 }
57249
57250 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
57251         LDKNodeInfo obj_conv;
57252         obj_conv.inner = untag_ptr(obj);
57253         obj_conv.is_owned = ptr_is_owned(obj);
57254         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57255         obj_conv.is_owned = false;
57256         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
57257         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57258         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57259         CVec_u8Z_free(ret_var);
57260         return ret_arr;
57261 }
57262
57263 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
57264         LDKu8slice ser_ref;
57265         ser_ref.datalen = ser->arr_len;
57266         ser_ref.data = ser->elems;
57267         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
57268         *ret_conv = NodeInfo_read(ser_ref);
57269         FREE(ser);
57270         return tag_ptr(ret_conv, true);
57271 }
57272
57273 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
57274         LDKNetworkGraph obj_conv;
57275         obj_conv.inner = untag_ptr(obj);
57276         obj_conv.is_owned = ptr_is_owned(obj);
57277         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57278         obj_conv.is_owned = false;
57279         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
57280         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57281         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57282         CVec_u8Z_free(ret_var);
57283         return ret_arr;
57284 }
57285
57286 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
57287         LDKu8slice ser_ref;
57288         ser_ref.datalen = ser->arr_len;
57289         ser_ref.data = ser->elems;
57290         void* arg_ptr = untag_ptr(arg);
57291         CHECK_ACCESS(arg_ptr);
57292         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
57293         if (arg_conv.free == LDKLogger_JCalls_free) {
57294                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57295                 LDKLogger_JCalls_cloned(&arg_conv);
57296         }
57297         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
57298         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
57299         FREE(ser);
57300         return tag_ptr(ret_conv, true);
57301 }
57302
57303 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
57304         LDKNetwork network_conv = LDKNetwork_from_js(network);
57305         void* logger_ptr = untag_ptr(logger);
57306         CHECK_ACCESS(logger_ptr);
57307         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57308         if (logger_conv.free == LDKLogger_JCalls_free) {
57309                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57310                 LDKLogger_JCalls_cloned(&logger_conv);
57311         }
57312         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
57313         uint64_t ret_ref = 0;
57314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57316         return ret_ref;
57317 }
57318
57319 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
57320         LDKNetworkGraph this_arg_conv;
57321         this_arg_conv.inner = untag_ptr(this_arg);
57322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57324         this_arg_conv.is_owned = false;
57325         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
57326         uint64_t ret_ref = 0;
57327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57329         return ret_ref;
57330 }
57331
57332 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) {
57333         LDKNetworkGraph this_arg_conv;
57334         this_arg_conv.inner = untag_ptr(this_arg);
57335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57337         this_arg_conv.is_owned = false;
57338         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
57339         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
57340         uint64_t ret_ref = tag_ptr(ret_copy, true);
57341         return ret_ref;
57342 }
57343
57344 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) {
57345         LDKNetworkGraph this_arg_conv;
57346         this_arg_conv.inner = untag_ptr(this_arg);
57347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57349         this_arg_conv.is_owned = false;
57350         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
57351 }
57352
57353 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
57354         LDKNetworkGraph this_arg_conv;
57355         this_arg_conv.inner = untag_ptr(this_arg);
57356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57358         this_arg_conv.is_owned = false;
57359         LDKNodeAnnouncement msg_conv;
57360         msg_conv.inner = untag_ptr(msg);
57361         msg_conv.is_owned = ptr_is_owned(msg);
57362         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57363         msg_conv.is_owned = false;
57364         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57365         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
57366         return tag_ptr(ret_conv, true);
57367 }
57368
57369 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) {
57370         LDKNetworkGraph this_arg_conv;
57371         this_arg_conv.inner = untag_ptr(this_arg);
57372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57374         this_arg_conv.is_owned = false;
57375         LDKUnsignedNodeAnnouncement msg_conv;
57376         msg_conv.inner = untag_ptr(msg);
57377         msg_conv.is_owned = ptr_is_owned(msg);
57378         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57379         msg_conv.is_owned = false;
57380         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57381         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
57382         return tag_ptr(ret_conv, true);
57383 }
57384
57385 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) {
57386         LDKNetworkGraph this_arg_conv;
57387         this_arg_conv.inner = untag_ptr(this_arg);
57388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57390         this_arg_conv.is_owned = false;
57391         LDKChannelAnnouncement msg_conv;
57392         msg_conv.inner = untag_ptr(msg);
57393         msg_conv.is_owned = ptr_is_owned(msg);
57394         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57395         msg_conv.is_owned = false;
57396         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
57397         CHECK_ACCESS(utxo_lookup_ptr);
57398         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
57399         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
57400         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
57401                 // Manually implement clone for Java trait instances
57402                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
57403                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57404                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
57405                 }
57406         }
57407         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57408         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
57409         return tag_ptr(ret_conv, true);
57410 }
57411
57412 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) {
57413         LDKNetworkGraph this_arg_conv;
57414         this_arg_conv.inner = untag_ptr(this_arg);
57415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57417         this_arg_conv.is_owned = false;
57418         LDKChannelAnnouncement msg_conv;
57419         msg_conv.inner = untag_ptr(msg);
57420         msg_conv.is_owned = ptr_is_owned(msg);
57421         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57422         msg_conv.is_owned = false;
57423         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57424         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
57425         return tag_ptr(ret_conv, true);
57426 }
57427
57428 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) {
57429         LDKNetworkGraph this_arg_conv;
57430         this_arg_conv.inner = untag_ptr(this_arg);
57431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57433         this_arg_conv.is_owned = false;
57434         LDKUnsignedChannelAnnouncement msg_conv;
57435         msg_conv.inner = untag_ptr(msg);
57436         msg_conv.is_owned = ptr_is_owned(msg);
57437         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57438         msg_conv.is_owned = false;
57439         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
57440         CHECK_ACCESS(utxo_lookup_ptr);
57441         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
57442         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
57443         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
57444                 // Manually implement clone for Java trait instances
57445                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
57446                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57447                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
57448                 }
57449         }
57450         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57451         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
57452         return tag_ptr(ret_conv, true);
57453 }
57454
57455 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) {
57456         LDKNetworkGraph this_arg_conv;
57457         this_arg_conv.inner = untag_ptr(this_arg);
57458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57460         this_arg_conv.is_owned = false;
57461         LDKChannelFeatures features_conv;
57462         features_conv.inner = untag_ptr(features);
57463         features_conv.is_owned = ptr_is_owned(features);
57464         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
57465         features_conv = ChannelFeatures_clone(&features_conv);
57466         LDKPublicKey node_id_1_ref;
57467         CHECK(node_id_1->arr_len == 33);
57468         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
57469         LDKPublicKey node_id_2_ref;
57470         CHECK(node_id_2->arr_len == 33);
57471         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
57472         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57473         *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);
57474         return tag_ptr(ret_conv, true);
57475 }
57476
57477 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
57478         LDKNetworkGraph this_arg_conv;
57479         this_arg_conv.inner = untag_ptr(this_arg);
57480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57482         this_arg_conv.is_owned = false;
57483         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
57484 }
57485
57486 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
57487         LDKNetworkGraph this_arg_conv;
57488         this_arg_conv.inner = untag_ptr(this_arg);
57489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57491         this_arg_conv.is_owned = false;
57492         LDKPublicKey node_id_ref;
57493         CHECK(node_id->arr_len == 33);
57494         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
57495         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
57496 }
57497
57498 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) {
57499         LDKNetworkGraph this_arg_conv;
57500         this_arg_conv.inner = untag_ptr(this_arg);
57501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57503         this_arg_conv.is_owned = false;
57504         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
57505 }
57506
57507 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
57508         LDKNetworkGraph this_arg_conv;
57509         this_arg_conv.inner = untag_ptr(this_arg);
57510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57512         this_arg_conv.is_owned = false;
57513         LDKChannelUpdate msg_conv;
57514         msg_conv.inner = untag_ptr(msg);
57515         msg_conv.is_owned = ptr_is_owned(msg);
57516         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57517         msg_conv.is_owned = false;
57518         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57519         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
57520         return tag_ptr(ret_conv, true);
57521 }
57522
57523 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
57524         LDKNetworkGraph this_arg_conv;
57525         this_arg_conv.inner = untag_ptr(this_arg);
57526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57528         this_arg_conv.is_owned = false;
57529         LDKUnsignedChannelUpdate msg_conv;
57530         msg_conv.inner = untag_ptr(msg);
57531         msg_conv.is_owned = ptr_is_owned(msg);
57532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57533         msg_conv.is_owned = false;
57534         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57535         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
57536         return tag_ptr(ret_conv, true);
57537 }
57538
57539 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
57540         LDKReadOnlyNetworkGraph this_arg_conv;
57541         this_arg_conv.inner = untag_ptr(this_arg);
57542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57544         this_arg_conv.is_owned = false;
57545         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
57546         uint64_t ret_ref = 0;
57547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57549         return ret_ref;
57550 }
57551
57552 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
57553         LDKReadOnlyNetworkGraph this_arg_conv;
57554         this_arg_conv.inner = untag_ptr(this_arg);
57555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57557         this_arg_conv.is_owned = false;
57558         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
57559         int64_tArray ret_arr = NULL;
57560         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
57561         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
57562         for (size_t i = 0; i < ret_var.datalen; i++) {
57563                 int64_t ret_conv_8_conv = ret_var.data[i];
57564                 ret_arr_ptr[i] = ret_conv_8_conv;
57565         }
57566         
57567         FREE(ret_var.data);
57568         return ret_arr;
57569 }
57570
57571 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
57572         LDKReadOnlyNetworkGraph this_arg_conv;
57573         this_arg_conv.inner = untag_ptr(this_arg);
57574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57576         this_arg_conv.is_owned = false;
57577         LDKNodeId node_id_conv;
57578         node_id_conv.inner = untag_ptr(node_id);
57579         node_id_conv.is_owned = ptr_is_owned(node_id);
57580         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
57581         node_id_conv.is_owned = false;
57582         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
57583         uint64_t ret_ref = 0;
57584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57586         return ret_ref;
57587 }
57588
57589 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
57590         LDKReadOnlyNetworkGraph this_arg_conv;
57591         this_arg_conv.inner = untag_ptr(this_arg);
57592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57594         this_arg_conv.is_owned = false;
57595         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
57596         uint64_tArray ret_arr = NULL;
57597         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
57598         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
57599         for (size_t i = 0; i < ret_var.datalen; i++) {
57600                 LDKNodeId ret_conv_8_var = ret_var.data[i];
57601                 uint64_t ret_conv_8_ref = 0;
57602                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
57603                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
57604                 ret_arr_ptr[i] = ret_conv_8_ref;
57605         }
57606         
57607         FREE(ret_var.data);
57608         return ret_arr;
57609 }
57610
57611 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
57612         LDKReadOnlyNetworkGraph this_arg_conv;
57613         this_arg_conv.inner = untag_ptr(this_arg);
57614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57616         this_arg_conv.is_owned = false;
57617         LDKPublicKey pubkey_ref;
57618         CHECK(pubkey->arr_len == 33);
57619         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
57620         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
57621         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
57622         uint64_t ret_ref = tag_ptr(ret_copy, true);
57623         return ret_ref;
57624 }
57625
57626 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
57627         LDKDefaultRouter this_obj_conv;
57628         this_obj_conv.inner = untag_ptr(this_obj);
57629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57631         DefaultRouter_free(this_obj_conv);
57632 }
57633
57634 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) {
57635         LDKNetworkGraph network_graph_conv;
57636         network_graph_conv.inner = untag_ptr(network_graph);
57637         network_graph_conv.is_owned = ptr_is_owned(network_graph);
57638         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
57639         network_graph_conv.is_owned = false;
57640         void* logger_ptr = untag_ptr(logger);
57641         CHECK_ACCESS(logger_ptr);
57642         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57643         if (logger_conv.free == LDKLogger_JCalls_free) {
57644                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57645                 LDKLogger_JCalls_cloned(&logger_conv);
57646         }
57647         LDKThirtyTwoBytes random_seed_bytes_ref;
57648         CHECK(random_seed_bytes->arr_len == 32);
57649         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
57650         void* scorer_ptr = untag_ptr(scorer);
57651         CHECK_ACCESS(scorer_ptr);
57652         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
57653         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
57654                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57655                 LDKLockableScore_JCalls_cloned(&scorer_conv);
57656         }
57657         LDKProbabilisticScoringFeeParameters score_params_conv;
57658         score_params_conv.inner = untag_ptr(score_params);
57659         score_params_conv.is_owned = ptr_is_owned(score_params);
57660         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
57661         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
57662         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
57663         uint64_t ret_ref = 0;
57664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57666         return ret_ref;
57667 }
57668
57669 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
57670         LDKDefaultRouter this_arg_conv;
57671         this_arg_conv.inner = untag_ptr(this_arg);
57672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57674         this_arg_conv.is_owned = false;
57675         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
57676         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
57677         return tag_ptr(ret_ret, true);
57678 }
57679
57680 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
57681         if (!ptr_is_owned(this_ptr)) return;
57682         void* this_ptr_ptr = untag_ptr(this_ptr);
57683         CHECK_ACCESS(this_ptr_ptr);
57684         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
57685         FREE(untag_ptr(this_ptr));
57686         Router_free(this_ptr_conv);
57687 }
57688
57689 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
57690         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
57691         this_obj_conv.inner = untag_ptr(this_obj);
57692         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57694         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
57695 }
57696
57697 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
57698         void* scorer_ptr = untag_ptr(scorer);
57699         CHECK_ACCESS(scorer_ptr);
57700         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
57701         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
57702                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57703                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
57704         }
57705         LDKInFlightHtlcs inflight_htlcs_conv;
57706         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
57707         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
57708         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
57709         inflight_htlcs_conv.is_owned = false;
57710         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
57711         uint64_t ret_ref = 0;
57712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57714         return ret_ref;
57715 }
57716
57717 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
57718         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
57719         this_arg_conv.inner = untag_ptr(this_arg);
57720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57722         this_arg_conv.is_owned = false;
57723         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
57724         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
57725         return tag_ptr(ret_ret, true);
57726 }
57727
57728 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
57729         LDKInFlightHtlcs this_obj_conv;
57730         this_obj_conv.inner = untag_ptr(this_obj);
57731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57733         InFlightHtlcs_free(this_obj_conv);
57734 }
57735
57736 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
57737         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
57738         uint64_t ret_ref = 0;
57739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57741         return ret_ref;
57742 }
57743 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
57744         LDKInFlightHtlcs arg_conv;
57745         arg_conv.inner = untag_ptr(arg);
57746         arg_conv.is_owned = ptr_is_owned(arg);
57747         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57748         arg_conv.is_owned = false;
57749         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
57750         return ret_conv;
57751 }
57752
57753 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
57754         LDKInFlightHtlcs orig_conv;
57755         orig_conv.inner = untag_ptr(orig);
57756         orig_conv.is_owned = ptr_is_owned(orig);
57757         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57758         orig_conv.is_owned = false;
57759         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
57760         uint64_t ret_ref = 0;
57761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57763         return ret_ref;
57764 }
57765
57766 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
57767         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
57768         uint64_t ret_ref = 0;
57769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57771         return ret_ref;
57772 }
57773
57774 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
57775         LDKInFlightHtlcs this_arg_conv;
57776         this_arg_conv.inner = untag_ptr(this_arg);
57777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57779         this_arg_conv.is_owned = false;
57780         LDKPath path_conv;
57781         path_conv.inner = untag_ptr(path);
57782         path_conv.is_owned = ptr_is_owned(path);
57783         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
57784         path_conv.is_owned = false;
57785         LDKPublicKey payer_node_id_ref;
57786         CHECK(payer_node_id->arr_len == 33);
57787         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
57788         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
57789 }
57790
57791 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) {
57792         LDKInFlightHtlcs this_arg_conv;
57793         this_arg_conv.inner = untag_ptr(this_arg);
57794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57796         this_arg_conv.is_owned = false;
57797         LDKNodeId source_conv;
57798         source_conv.inner = untag_ptr(source);
57799         source_conv.is_owned = ptr_is_owned(source);
57800         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
57801         source_conv.is_owned = false;
57802         LDKNodeId target_conv;
57803         target_conv.inner = untag_ptr(target);
57804         target_conv.is_owned = ptr_is_owned(target);
57805         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
57806         target_conv.is_owned = false;
57807         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
57808 }
57809
57810 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) {
57811         LDKInFlightHtlcs 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         LDKNodeId source_conv;
57817         source_conv.inner = untag_ptr(source);
57818         source_conv.is_owned = ptr_is_owned(source);
57819         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
57820         source_conv.is_owned = false;
57821         LDKNodeId target_conv;
57822         target_conv.inner = untag_ptr(target);
57823         target_conv.is_owned = ptr_is_owned(target);
57824         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
57825         target_conv.is_owned = false;
57826         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
57827         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
57828         uint64_t ret_ref = tag_ptr(ret_copy, true);
57829         return ret_ref;
57830 }
57831
57832 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
57833         LDKInFlightHtlcs obj_conv;
57834         obj_conv.inner = untag_ptr(obj);
57835         obj_conv.is_owned = ptr_is_owned(obj);
57836         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57837         obj_conv.is_owned = false;
57838         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
57839         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57840         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57841         CVec_u8Z_free(ret_var);
57842         return ret_arr;
57843 }
57844
57845 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
57846         LDKu8slice ser_ref;
57847         ser_ref.datalen = ser->arr_len;
57848         ser_ref.data = ser->elems;
57849         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
57850         *ret_conv = InFlightHtlcs_read(ser_ref);
57851         FREE(ser);
57852         return tag_ptr(ret_conv, true);
57853 }
57854
57855 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
57856         LDKRouteHop this_obj_conv;
57857         this_obj_conv.inner = untag_ptr(this_obj);
57858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57860         RouteHop_free(this_obj_conv);
57861 }
57862
57863 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
57864         LDKRouteHop this_ptr_conv;
57865         this_ptr_conv.inner = untag_ptr(this_ptr);
57866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57868         this_ptr_conv.is_owned = false;
57869         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57870         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
57871         return ret_arr;
57872 }
57873
57874 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
57875         LDKRouteHop this_ptr_conv;
57876         this_ptr_conv.inner = untag_ptr(this_ptr);
57877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57879         this_ptr_conv.is_owned = false;
57880         LDKPublicKey val_ref;
57881         CHECK(val->arr_len == 33);
57882         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57883         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
57884 }
57885
57886 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
57887         LDKRouteHop this_ptr_conv;
57888         this_ptr_conv.inner = untag_ptr(this_ptr);
57889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57891         this_ptr_conv.is_owned = false;
57892         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
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 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
57900         LDKRouteHop this_ptr_conv;
57901         this_ptr_conv.inner = untag_ptr(this_ptr);
57902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57904         this_ptr_conv.is_owned = false;
57905         LDKNodeFeatures val_conv;
57906         val_conv.inner = untag_ptr(val);
57907         val_conv.is_owned = ptr_is_owned(val);
57908         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57909         val_conv = NodeFeatures_clone(&val_conv);
57910         RouteHop_set_node_features(&this_ptr_conv, val_conv);
57911 }
57912
57913 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
57914         LDKRouteHop this_ptr_conv;
57915         this_ptr_conv.inner = untag_ptr(this_ptr);
57916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57918         this_ptr_conv.is_owned = false;
57919         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
57920         return ret_conv;
57921 }
57922
57923 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
57924         LDKRouteHop this_ptr_conv;
57925         this_ptr_conv.inner = untag_ptr(this_ptr);
57926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57928         this_ptr_conv.is_owned = false;
57929         RouteHop_set_short_channel_id(&this_ptr_conv, val);
57930 }
57931
57932 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
57933         LDKRouteHop this_ptr_conv;
57934         this_ptr_conv.inner = untag_ptr(this_ptr);
57935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57937         this_ptr_conv.is_owned = false;
57938         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
57939         uint64_t ret_ref = 0;
57940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57942         return ret_ref;
57943 }
57944
57945 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
57946         LDKRouteHop this_ptr_conv;
57947         this_ptr_conv.inner = untag_ptr(this_ptr);
57948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57950         this_ptr_conv.is_owned = false;
57951         LDKChannelFeatures val_conv;
57952         val_conv.inner = untag_ptr(val);
57953         val_conv.is_owned = ptr_is_owned(val);
57954         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57955         val_conv = ChannelFeatures_clone(&val_conv);
57956         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
57957 }
57958
57959 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
57960         LDKRouteHop this_ptr_conv;
57961         this_ptr_conv.inner = untag_ptr(this_ptr);
57962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57964         this_ptr_conv.is_owned = false;
57965         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
57966         return ret_conv;
57967 }
57968
57969 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
57970         LDKRouteHop this_ptr_conv;
57971         this_ptr_conv.inner = untag_ptr(this_ptr);
57972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57974         this_ptr_conv.is_owned = false;
57975         RouteHop_set_fee_msat(&this_ptr_conv, val);
57976 }
57977
57978 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
57979         LDKRouteHop this_ptr_conv;
57980         this_ptr_conv.inner = untag_ptr(this_ptr);
57981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57983         this_ptr_conv.is_owned = false;
57984         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
57985         return ret_conv;
57986 }
57987
57988 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
57989         LDKRouteHop this_ptr_conv;
57990         this_ptr_conv.inner = untag_ptr(this_ptr);
57991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57993         this_ptr_conv.is_owned = false;
57994         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
57995 }
57996
57997 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
57998         LDKRouteHop this_ptr_conv;
57999         this_ptr_conv.inner = untag_ptr(this_ptr);
58000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58002         this_ptr_conv.is_owned = false;
58003         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
58004         return ret_conv;
58005 }
58006
58007 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
58008         LDKRouteHop this_ptr_conv;
58009         this_ptr_conv.inner = untag_ptr(this_ptr);
58010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58012         this_ptr_conv.is_owned = false;
58013         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
58014 }
58015
58016 uint64_t  __attribute__((export_name("TS_RouteHop_new"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint64_t node_features_arg, int64_t short_channel_id_arg, uint64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg, jboolean maybe_announced_channel_arg) {
58017         LDKPublicKey pubkey_arg_ref;
58018         CHECK(pubkey_arg->arr_len == 33);
58019         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
58020         LDKNodeFeatures node_features_arg_conv;
58021         node_features_arg_conv.inner = untag_ptr(node_features_arg);
58022         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
58023         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
58024         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
58025         LDKChannelFeatures channel_features_arg_conv;
58026         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
58027         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
58028         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
58029         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
58030         LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg, maybe_announced_channel_arg);
58031         uint64_t ret_ref = 0;
58032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58034         return ret_ref;
58035 }
58036
58037 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
58038         LDKRouteHop ret_var = RouteHop_clone(arg);
58039         uint64_t ret_ref = 0;
58040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58042         return ret_ref;
58043 }
58044 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
58045         LDKRouteHop arg_conv;
58046         arg_conv.inner = untag_ptr(arg);
58047         arg_conv.is_owned = ptr_is_owned(arg);
58048         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58049         arg_conv.is_owned = false;
58050         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
58051         return ret_conv;
58052 }
58053
58054 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
58055         LDKRouteHop orig_conv;
58056         orig_conv.inner = untag_ptr(orig);
58057         orig_conv.is_owned = ptr_is_owned(orig);
58058         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58059         orig_conv.is_owned = false;
58060         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
58061         uint64_t ret_ref = 0;
58062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58064         return ret_ref;
58065 }
58066
58067 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
58068         LDKRouteHop o_conv;
58069         o_conv.inner = untag_ptr(o);
58070         o_conv.is_owned = ptr_is_owned(o);
58071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58072         o_conv.is_owned = false;
58073         int64_t ret_conv = RouteHop_hash(&o_conv);
58074         return ret_conv;
58075 }
58076
58077 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
58078         LDKRouteHop a_conv;
58079         a_conv.inner = untag_ptr(a);
58080         a_conv.is_owned = ptr_is_owned(a);
58081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58082         a_conv.is_owned = false;
58083         LDKRouteHop b_conv;
58084         b_conv.inner = untag_ptr(b);
58085         b_conv.is_owned = ptr_is_owned(b);
58086         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58087         b_conv.is_owned = false;
58088         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
58089         return ret_conv;
58090 }
58091
58092 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
58093         LDKRouteHop obj_conv;
58094         obj_conv.inner = untag_ptr(obj);
58095         obj_conv.is_owned = ptr_is_owned(obj);
58096         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58097         obj_conv.is_owned = false;
58098         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
58099         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58100         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58101         CVec_u8Z_free(ret_var);
58102         return ret_arr;
58103 }
58104
58105 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
58106         LDKu8slice ser_ref;
58107         ser_ref.datalen = ser->arr_len;
58108         ser_ref.data = ser->elems;
58109         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
58110         *ret_conv = RouteHop_read(ser_ref);
58111         FREE(ser);
58112         return tag_ptr(ret_conv, true);
58113 }
58114
58115 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
58116         LDKBlindedTail this_obj_conv;
58117         this_obj_conv.inner = untag_ptr(this_obj);
58118         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58120         BlindedTail_free(this_obj_conv);
58121 }
58122
58123 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
58124         LDKBlindedTail this_ptr_conv;
58125         this_ptr_conv.inner = untag_ptr(this_ptr);
58126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58128         this_ptr_conv.is_owned = false;
58129         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
58130         uint64_tArray ret_arr = NULL;
58131         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58132         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58133         for (size_t m = 0; m < ret_var.datalen; m++) {
58134                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
58135                 uint64_t ret_conv_12_ref = 0;
58136                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
58137                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
58138                 ret_arr_ptr[m] = ret_conv_12_ref;
58139         }
58140         
58141         FREE(ret_var.data);
58142         return ret_arr;
58143 }
58144
58145 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
58146         LDKBlindedTail this_ptr_conv;
58147         this_ptr_conv.inner = untag_ptr(this_ptr);
58148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58150         this_ptr_conv.is_owned = false;
58151         LDKCVec_BlindedHopZ val_constr;
58152         val_constr.datalen = val->arr_len;
58153         if (val_constr.datalen > 0)
58154                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
58155         else
58156                 val_constr.data = NULL;
58157         uint64_t* val_vals = val->elems;
58158         for (size_t m = 0; m < val_constr.datalen; m++) {
58159                 uint64_t val_conv_12 = val_vals[m];
58160                 LDKBlindedHop val_conv_12_conv;
58161                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
58162                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
58163                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
58164                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
58165                 val_constr.data[m] = val_conv_12_conv;
58166         }
58167         FREE(val);
58168         BlindedTail_set_hops(&this_ptr_conv, val_constr);
58169 }
58170
58171 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
58172         LDKBlindedTail this_ptr_conv;
58173         this_ptr_conv.inner = untag_ptr(this_ptr);
58174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58176         this_ptr_conv.is_owned = false;
58177         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58178         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
58179         return ret_arr;
58180 }
58181
58182 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
58183         LDKBlindedTail this_ptr_conv;
58184         this_ptr_conv.inner = untag_ptr(this_ptr);
58185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58187         this_ptr_conv.is_owned = false;
58188         LDKPublicKey val_ref;
58189         CHECK(val->arr_len == 33);
58190         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58191         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
58192 }
58193
58194 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) {
58195         LDKBlindedTail this_ptr_conv;
58196         this_ptr_conv.inner = untag_ptr(this_ptr);
58197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58199         this_ptr_conv.is_owned = false;
58200         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
58201         return ret_conv;
58202 }
58203
58204 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) {
58205         LDKBlindedTail this_ptr_conv;
58206         this_ptr_conv.inner = untag_ptr(this_ptr);
58207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58209         this_ptr_conv.is_owned = false;
58210         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
58211 }
58212
58213 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
58214         LDKBlindedTail 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         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
58220         return ret_conv;
58221 }
58222
58223 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
58224         LDKBlindedTail this_ptr_conv;
58225         this_ptr_conv.inner = untag_ptr(this_ptr);
58226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58228         this_ptr_conv.is_owned = false;
58229         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
58230 }
58231
58232 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) {
58233         LDKCVec_BlindedHopZ hops_arg_constr;
58234         hops_arg_constr.datalen = hops_arg->arr_len;
58235         if (hops_arg_constr.datalen > 0)
58236                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
58237         else
58238                 hops_arg_constr.data = NULL;
58239         uint64_t* hops_arg_vals = hops_arg->elems;
58240         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
58241                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
58242                 LDKBlindedHop hops_arg_conv_12_conv;
58243                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
58244                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
58245                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
58246                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
58247                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
58248         }
58249         FREE(hops_arg);
58250         LDKPublicKey blinding_point_arg_ref;
58251         CHECK(blinding_point_arg->arr_len == 33);
58252         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
58253         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
58254         uint64_t ret_ref = 0;
58255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58257         return ret_ref;
58258 }
58259
58260 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
58261         LDKBlindedTail ret_var = BlindedTail_clone(arg);
58262         uint64_t ret_ref = 0;
58263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58265         return ret_ref;
58266 }
58267 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
58268         LDKBlindedTail arg_conv;
58269         arg_conv.inner = untag_ptr(arg);
58270         arg_conv.is_owned = ptr_is_owned(arg);
58271         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58272         arg_conv.is_owned = false;
58273         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
58274         return ret_conv;
58275 }
58276
58277 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
58278         LDKBlindedTail orig_conv;
58279         orig_conv.inner = untag_ptr(orig);
58280         orig_conv.is_owned = ptr_is_owned(orig);
58281         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58282         orig_conv.is_owned = false;
58283         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
58284         uint64_t ret_ref = 0;
58285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58287         return ret_ref;
58288 }
58289
58290 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
58291         LDKBlindedTail o_conv;
58292         o_conv.inner = untag_ptr(o);
58293         o_conv.is_owned = ptr_is_owned(o);
58294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58295         o_conv.is_owned = false;
58296         int64_t ret_conv = BlindedTail_hash(&o_conv);
58297         return ret_conv;
58298 }
58299
58300 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
58301         LDKBlindedTail a_conv;
58302         a_conv.inner = untag_ptr(a);
58303         a_conv.is_owned = ptr_is_owned(a);
58304         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58305         a_conv.is_owned = false;
58306         LDKBlindedTail b_conv;
58307         b_conv.inner = untag_ptr(b);
58308         b_conv.is_owned = ptr_is_owned(b);
58309         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58310         b_conv.is_owned = false;
58311         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
58312         return ret_conv;
58313 }
58314
58315 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
58316         LDKBlindedTail obj_conv;
58317         obj_conv.inner = untag_ptr(obj);
58318         obj_conv.is_owned = ptr_is_owned(obj);
58319         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58320         obj_conv.is_owned = false;
58321         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
58322         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58323         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58324         CVec_u8Z_free(ret_var);
58325         return ret_arr;
58326 }
58327
58328 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
58329         LDKu8slice ser_ref;
58330         ser_ref.datalen = ser->arr_len;
58331         ser_ref.data = ser->elems;
58332         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
58333         *ret_conv = BlindedTail_read(ser_ref);
58334         FREE(ser);
58335         return tag_ptr(ret_conv, true);
58336 }
58337
58338 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
58339         LDKPath this_obj_conv;
58340         this_obj_conv.inner = untag_ptr(this_obj);
58341         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58343         Path_free(this_obj_conv);
58344 }
58345
58346 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
58347         LDKPath this_ptr_conv;
58348         this_ptr_conv.inner = untag_ptr(this_ptr);
58349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58351         this_ptr_conv.is_owned = false;
58352         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
58353         uint64_tArray ret_arr = NULL;
58354         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58355         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58356         for (size_t k = 0; k < ret_var.datalen; k++) {
58357                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
58358                 uint64_t ret_conv_10_ref = 0;
58359                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
58360                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
58361                 ret_arr_ptr[k] = ret_conv_10_ref;
58362         }
58363         
58364         FREE(ret_var.data);
58365         return ret_arr;
58366 }
58367
58368 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
58369         LDKPath this_ptr_conv;
58370         this_ptr_conv.inner = untag_ptr(this_ptr);
58371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58373         this_ptr_conv.is_owned = false;
58374         LDKCVec_RouteHopZ val_constr;
58375         val_constr.datalen = val->arr_len;
58376         if (val_constr.datalen > 0)
58377                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
58378         else
58379                 val_constr.data = NULL;
58380         uint64_t* val_vals = val->elems;
58381         for (size_t k = 0; k < val_constr.datalen; k++) {
58382                 uint64_t val_conv_10 = val_vals[k];
58383                 LDKRouteHop val_conv_10_conv;
58384                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
58385                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
58386                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
58387                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
58388                 val_constr.data[k] = val_conv_10_conv;
58389         }
58390         FREE(val);
58391         Path_set_hops(&this_ptr_conv, val_constr);
58392 }
58393
58394 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
58395         LDKPath this_ptr_conv;
58396         this_ptr_conv.inner = untag_ptr(this_ptr);
58397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58399         this_ptr_conv.is_owned = false;
58400         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
58401         uint64_t ret_ref = 0;
58402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58404         return ret_ref;
58405 }
58406
58407 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
58408         LDKPath this_ptr_conv;
58409         this_ptr_conv.inner = untag_ptr(this_ptr);
58410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58412         this_ptr_conv.is_owned = false;
58413         LDKBlindedTail val_conv;
58414         val_conv.inner = untag_ptr(val);
58415         val_conv.is_owned = ptr_is_owned(val);
58416         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58417         val_conv = BlindedTail_clone(&val_conv);
58418         Path_set_blinded_tail(&this_ptr_conv, val_conv);
58419 }
58420
58421 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
58422         LDKCVec_RouteHopZ hops_arg_constr;
58423         hops_arg_constr.datalen = hops_arg->arr_len;
58424         if (hops_arg_constr.datalen > 0)
58425                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
58426         else
58427                 hops_arg_constr.data = NULL;
58428         uint64_t* hops_arg_vals = hops_arg->elems;
58429         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
58430                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
58431                 LDKRouteHop hops_arg_conv_10_conv;
58432                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
58433                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
58434                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
58435                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
58436                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
58437         }
58438         FREE(hops_arg);
58439         LDKBlindedTail blinded_tail_arg_conv;
58440         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
58441         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
58442         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
58443         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
58444         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
58445         uint64_t ret_ref = 0;
58446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58448         return ret_ref;
58449 }
58450
58451 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
58452         LDKPath ret_var = Path_clone(arg);
58453         uint64_t ret_ref = 0;
58454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58456         return ret_ref;
58457 }
58458 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
58459         LDKPath arg_conv;
58460         arg_conv.inner = untag_ptr(arg);
58461         arg_conv.is_owned = ptr_is_owned(arg);
58462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58463         arg_conv.is_owned = false;
58464         int64_t ret_conv = Path_clone_ptr(&arg_conv);
58465         return ret_conv;
58466 }
58467
58468 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
58469         LDKPath orig_conv;
58470         orig_conv.inner = untag_ptr(orig);
58471         orig_conv.is_owned = ptr_is_owned(orig);
58472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58473         orig_conv.is_owned = false;
58474         LDKPath ret_var = Path_clone(&orig_conv);
58475         uint64_t ret_ref = 0;
58476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58478         return ret_ref;
58479 }
58480
58481 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
58482         LDKPath o_conv;
58483         o_conv.inner = untag_ptr(o);
58484         o_conv.is_owned = ptr_is_owned(o);
58485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58486         o_conv.is_owned = false;
58487         int64_t ret_conv = Path_hash(&o_conv);
58488         return ret_conv;
58489 }
58490
58491 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
58492         LDKPath a_conv;
58493         a_conv.inner = untag_ptr(a);
58494         a_conv.is_owned = ptr_is_owned(a);
58495         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58496         a_conv.is_owned = false;
58497         LDKPath b_conv;
58498         b_conv.inner = untag_ptr(b);
58499         b_conv.is_owned = ptr_is_owned(b);
58500         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58501         b_conv.is_owned = false;
58502         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
58503         return ret_conv;
58504 }
58505
58506 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
58507         LDKPath this_arg_conv;
58508         this_arg_conv.inner = untag_ptr(this_arg);
58509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58511         this_arg_conv.is_owned = false;
58512         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
58513         return ret_conv;
58514 }
58515
58516 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
58517         LDKPath this_arg_conv;
58518         this_arg_conv.inner = untag_ptr(this_arg);
58519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58521         this_arg_conv.is_owned = false;
58522         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
58523         return ret_conv;
58524 }
58525
58526 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
58527         LDKPath this_arg_conv;
58528         this_arg_conv.inner = untag_ptr(this_arg);
58529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58531         this_arg_conv.is_owned = false;
58532         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
58533         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
58534         uint64_t ret_ref = tag_ptr(ret_copy, true);
58535         return ret_ref;
58536 }
58537
58538 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
58539         LDKRoute this_obj_conv;
58540         this_obj_conv.inner = untag_ptr(this_obj);
58541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58543         Route_free(this_obj_conv);
58544 }
58545
58546 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
58547         LDKRoute this_ptr_conv;
58548         this_ptr_conv.inner = untag_ptr(this_ptr);
58549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58551         this_ptr_conv.is_owned = false;
58552         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
58553         uint64_tArray ret_arr = NULL;
58554         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58555         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58556         for (size_t g = 0; g < ret_var.datalen; g++) {
58557                 LDKPath ret_conv_6_var = ret_var.data[g];
58558                 uint64_t ret_conv_6_ref = 0;
58559                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
58560                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
58561                 ret_arr_ptr[g] = ret_conv_6_ref;
58562         }
58563         
58564         FREE(ret_var.data);
58565         return ret_arr;
58566 }
58567
58568 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
58569         LDKRoute this_ptr_conv;
58570         this_ptr_conv.inner = untag_ptr(this_ptr);
58571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58573         this_ptr_conv.is_owned = false;
58574         LDKCVec_PathZ val_constr;
58575         val_constr.datalen = val->arr_len;
58576         if (val_constr.datalen > 0)
58577                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
58578         else
58579                 val_constr.data = NULL;
58580         uint64_t* val_vals = val->elems;
58581         for (size_t g = 0; g < val_constr.datalen; g++) {
58582                 uint64_t val_conv_6 = val_vals[g];
58583                 LDKPath val_conv_6_conv;
58584                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
58585                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
58586                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
58587                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
58588                 val_constr.data[g] = val_conv_6_conv;
58589         }
58590         FREE(val);
58591         Route_set_paths(&this_ptr_conv, val_constr);
58592 }
58593
58594 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
58595         LDKRoute this_ptr_conv;
58596         this_ptr_conv.inner = untag_ptr(this_ptr);
58597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58599         this_ptr_conv.is_owned = false;
58600         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
58601         uint64_t ret_ref = 0;
58602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58604         return ret_ref;
58605 }
58606
58607 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
58608         LDKRoute this_ptr_conv;
58609         this_ptr_conv.inner = untag_ptr(this_ptr);
58610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58612         this_ptr_conv.is_owned = false;
58613         LDKRouteParameters val_conv;
58614         val_conv.inner = untag_ptr(val);
58615         val_conv.is_owned = ptr_is_owned(val);
58616         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58617         val_conv = RouteParameters_clone(&val_conv);
58618         Route_set_route_params(&this_ptr_conv, val_conv);
58619 }
58620
58621 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
58622         LDKCVec_PathZ paths_arg_constr;
58623         paths_arg_constr.datalen = paths_arg->arr_len;
58624         if (paths_arg_constr.datalen > 0)
58625                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
58626         else
58627                 paths_arg_constr.data = NULL;
58628         uint64_t* paths_arg_vals = paths_arg->elems;
58629         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
58630                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
58631                 LDKPath paths_arg_conv_6_conv;
58632                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
58633                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
58634                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
58635                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
58636                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
58637         }
58638         FREE(paths_arg);
58639         LDKRouteParameters route_params_arg_conv;
58640         route_params_arg_conv.inner = untag_ptr(route_params_arg);
58641         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
58642         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
58643         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
58644         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
58645         uint64_t ret_ref = 0;
58646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58648         return ret_ref;
58649 }
58650
58651 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
58652         LDKRoute ret_var = Route_clone(arg);
58653         uint64_t ret_ref = 0;
58654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58656         return ret_ref;
58657 }
58658 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
58659         LDKRoute arg_conv;
58660         arg_conv.inner = untag_ptr(arg);
58661         arg_conv.is_owned = ptr_is_owned(arg);
58662         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58663         arg_conv.is_owned = false;
58664         int64_t ret_conv = Route_clone_ptr(&arg_conv);
58665         return ret_conv;
58666 }
58667
58668 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
58669         LDKRoute orig_conv;
58670         orig_conv.inner = untag_ptr(orig);
58671         orig_conv.is_owned = ptr_is_owned(orig);
58672         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58673         orig_conv.is_owned = false;
58674         LDKRoute ret_var = Route_clone(&orig_conv);
58675         uint64_t ret_ref = 0;
58676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58678         return ret_ref;
58679 }
58680
58681 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
58682         LDKRoute o_conv;
58683         o_conv.inner = untag_ptr(o);
58684         o_conv.is_owned = ptr_is_owned(o);
58685         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58686         o_conv.is_owned = false;
58687         int64_t ret_conv = Route_hash(&o_conv);
58688         return ret_conv;
58689 }
58690
58691 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
58692         LDKRoute a_conv;
58693         a_conv.inner = untag_ptr(a);
58694         a_conv.is_owned = ptr_is_owned(a);
58695         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58696         a_conv.is_owned = false;
58697         LDKRoute b_conv;
58698         b_conv.inner = untag_ptr(b);
58699         b_conv.is_owned = ptr_is_owned(b);
58700         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58701         b_conv.is_owned = false;
58702         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
58703         return ret_conv;
58704 }
58705
58706 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
58707         LDKRoute this_arg_conv;
58708         this_arg_conv.inner = untag_ptr(this_arg);
58709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58711         this_arg_conv.is_owned = false;
58712         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
58713         return ret_conv;
58714 }
58715
58716 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
58717         LDKRoute this_arg_conv;
58718         this_arg_conv.inner = untag_ptr(this_arg);
58719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58721         this_arg_conv.is_owned = false;
58722         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
58723         return ret_conv;
58724 }
58725
58726 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
58727         LDKRoute obj_conv;
58728         obj_conv.inner = untag_ptr(obj);
58729         obj_conv.is_owned = ptr_is_owned(obj);
58730         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58731         obj_conv.is_owned = false;
58732         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
58733         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58734         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58735         CVec_u8Z_free(ret_var);
58736         return ret_arr;
58737 }
58738
58739 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
58740         LDKu8slice ser_ref;
58741         ser_ref.datalen = ser->arr_len;
58742         ser_ref.data = ser->elems;
58743         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
58744         *ret_conv = Route_read(ser_ref);
58745         FREE(ser);
58746         return tag_ptr(ret_conv, true);
58747 }
58748
58749 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
58750         LDKRouteParameters this_obj_conv;
58751         this_obj_conv.inner = untag_ptr(this_obj);
58752         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58754         RouteParameters_free(this_obj_conv);
58755 }
58756
58757 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
58758         LDKRouteParameters this_ptr_conv;
58759         this_ptr_conv.inner = untag_ptr(this_ptr);
58760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58762         this_ptr_conv.is_owned = false;
58763         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
58764         uint64_t ret_ref = 0;
58765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58767         return ret_ref;
58768 }
58769
58770 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
58771         LDKRouteParameters this_ptr_conv;
58772         this_ptr_conv.inner = untag_ptr(this_ptr);
58773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58775         this_ptr_conv.is_owned = false;
58776         LDKPaymentParameters val_conv;
58777         val_conv.inner = untag_ptr(val);
58778         val_conv.is_owned = ptr_is_owned(val);
58779         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58780         val_conv = PaymentParameters_clone(&val_conv);
58781         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
58782 }
58783
58784 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
58785         LDKRouteParameters this_ptr_conv;
58786         this_ptr_conv.inner = untag_ptr(this_ptr);
58787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58789         this_ptr_conv.is_owned = false;
58790         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
58791         return ret_conv;
58792 }
58793
58794 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
58795         LDKRouteParameters this_ptr_conv;
58796         this_ptr_conv.inner = untag_ptr(this_ptr);
58797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58799         this_ptr_conv.is_owned = false;
58800         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
58801 }
58802
58803 uint64_t  __attribute__((export_name("TS_RouteParameters_get_max_total_routing_fee_msat"))) TS_RouteParameters_get_max_total_routing_fee_msat(uint64_t this_ptr) {
58804         LDKRouteParameters this_ptr_conv;
58805         this_ptr_conv.inner = untag_ptr(this_ptr);
58806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58808         this_ptr_conv.is_owned = false;
58809         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58810         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
58811         uint64_t ret_ref = tag_ptr(ret_copy, true);
58812         return ret_ref;
58813 }
58814
58815 void  __attribute__((export_name("TS_RouteParameters_set_max_total_routing_fee_msat"))) TS_RouteParameters_set_max_total_routing_fee_msat(uint64_t this_ptr, uint64_t val) {
58816         LDKRouteParameters this_ptr_conv;
58817         this_ptr_conv.inner = untag_ptr(this_ptr);
58818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58820         this_ptr_conv.is_owned = false;
58821         void* val_ptr = untag_ptr(val);
58822         CHECK_ACCESS(val_ptr);
58823         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
58824         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
58825         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
58826 }
58827
58828 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg, uint64_t max_total_routing_fee_msat_arg) {
58829         LDKPaymentParameters payment_params_arg_conv;
58830         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
58831         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
58832         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
58833         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
58834         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
58835         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
58836         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
58837         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
58838         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
58839         uint64_t ret_ref = 0;
58840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58842         return ret_ref;
58843 }
58844
58845 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
58846         LDKRouteParameters ret_var = RouteParameters_clone(arg);
58847         uint64_t ret_ref = 0;
58848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58850         return ret_ref;
58851 }
58852 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
58853         LDKRouteParameters arg_conv;
58854         arg_conv.inner = untag_ptr(arg);
58855         arg_conv.is_owned = ptr_is_owned(arg);
58856         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58857         arg_conv.is_owned = false;
58858         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
58859         return ret_conv;
58860 }
58861
58862 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
58863         LDKRouteParameters orig_conv;
58864         orig_conv.inner = untag_ptr(orig);
58865         orig_conv.is_owned = ptr_is_owned(orig);
58866         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58867         orig_conv.is_owned = false;
58868         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
58869         uint64_t ret_ref = 0;
58870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58872         return ret_ref;
58873 }
58874
58875 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
58876         LDKRouteParameters o_conv;
58877         o_conv.inner = untag_ptr(o);
58878         o_conv.is_owned = ptr_is_owned(o);
58879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58880         o_conv.is_owned = false;
58881         int64_t ret_conv = RouteParameters_hash(&o_conv);
58882         return ret_conv;
58883 }
58884
58885 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
58886         LDKRouteParameters a_conv;
58887         a_conv.inner = untag_ptr(a);
58888         a_conv.is_owned = ptr_is_owned(a);
58889         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58890         a_conv.is_owned = false;
58891         LDKRouteParameters b_conv;
58892         b_conv.inner = untag_ptr(b);
58893         b_conv.is_owned = ptr_is_owned(b);
58894         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58895         b_conv.is_owned = false;
58896         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
58897         return ret_conv;
58898 }
58899
58900 uint64_t  __attribute__((export_name("TS_RouteParameters_from_payment_params_and_value"))) TS_RouteParameters_from_payment_params_and_value(uint64_t payment_params, int64_t final_value_msat) {
58901         LDKPaymentParameters payment_params_conv;
58902         payment_params_conv.inner = untag_ptr(payment_params);
58903         payment_params_conv.is_owned = ptr_is_owned(payment_params);
58904         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
58905         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
58906         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
58907         uint64_t ret_ref = 0;
58908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58910         return ret_ref;
58911 }
58912
58913 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
58914         LDKRouteParameters obj_conv;
58915         obj_conv.inner = untag_ptr(obj);
58916         obj_conv.is_owned = ptr_is_owned(obj);
58917         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58918         obj_conv.is_owned = false;
58919         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
58920         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58921         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58922         CVec_u8Z_free(ret_var);
58923         return ret_arr;
58924 }
58925
58926 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
58927         LDKu8slice ser_ref;
58928         ser_ref.datalen = ser->arr_len;
58929         ser_ref.data = ser->elems;
58930         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
58931         *ret_conv = RouteParameters_read(ser_ref);
58932         FREE(ser);
58933         return tag_ptr(ret_conv, true);
58934 }
58935
58936 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
58937         LDKPaymentParameters this_obj_conv;
58938         this_obj_conv.inner = untag_ptr(this_obj);
58939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58941         PaymentParameters_free(this_obj_conv);
58942 }
58943
58944 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
58945         LDKPaymentParameters this_ptr_conv;
58946         this_ptr_conv.inner = untag_ptr(this_ptr);
58947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58949         this_ptr_conv.is_owned = false;
58950         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
58951         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
58952         uint64_t ret_ref = tag_ptr(ret_copy, true);
58953         return ret_ref;
58954 }
58955
58956 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
58957         LDKPaymentParameters this_ptr_conv;
58958         this_ptr_conv.inner = untag_ptr(this_ptr);
58959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58961         this_ptr_conv.is_owned = false;
58962         void* val_ptr = untag_ptr(val);
58963         CHECK_ACCESS(val_ptr);
58964         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
58965         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
58966         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
58967 }
58968
58969 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
58970         LDKPaymentParameters this_ptr_conv;
58971         this_ptr_conv.inner = untag_ptr(this_ptr);
58972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58974         this_ptr_conv.is_owned = false;
58975         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58976         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
58977         uint64_t ret_ref = tag_ptr(ret_copy, true);
58978         return ret_ref;
58979 }
58980
58981 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
58982         LDKPaymentParameters this_ptr_conv;
58983         this_ptr_conv.inner = untag_ptr(this_ptr);
58984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58986         this_ptr_conv.is_owned = false;
58987         void* val_ptr = untag_ptr(val);
58988         CHECK_ACCESS(val_ptr);
58989         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
58990         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
58991         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
58992 }
58993
58994 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) {
58995         LDKPaymentParameters this_ptr_conv;
58996         this_ptr_conv.inner = untag_ptr(this_ptr);
58997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58999         this_ptr_conv.is_owned = false;
59000         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
59001         return ret_conv;
59002 }
59003
59004 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) {
59005         LDKPaymentParameters this_ptr_conv;
59006         this_ptr_conv.inner = untag_ptr(this_ptr);
59007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59009         this_ptr_conv.is_owned = false;
59010         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
59011 }
59012
59013 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
59014         LDKPaymentParameters this_ptr_conv;
59015         this_ptr_conv.inner = untag_ptr(this_ptr);
59016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59018         this_ptr_conv.is_owned = false;
59019         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
59020         return ret_conv;
59021 }
59022
59023 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
59024         LDKPaymentParameters this_ptr_conv;
59025         this_ptr_conv.inner = untag_ptr(this_ptr);
59026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59028         this_ptr_conv.is_owned = false;
59029         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
59030 }
59031
59032 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) {
59033         LDKPaymentParameters this_ptr_conv;
59034         this_ptr_conv.inner = untag_ptr(this_ptr);
59035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59037         this_ptr_conv.is_owned = false;
59038         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
59039         return ret_conv;
59040 }
59041
59042 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) {
59043         LDKPaymentParameters this_ptr_conv;
59044         this_ptr_conv.inner = untag_ptr(this_ptr);
59045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59047         this_ptr_conv.is_owned = false;
59048         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
59049 }
59050
59051 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
59052         LDKPaymentParameters this_ptr_conv;
59053         this_ptr_conv.inner = untag_ptr(this_ptr);
59054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59056         this_ptr_conv.is_owned = false;
59057         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
59058         int64_tArray ret_arr = NULL;
59059         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59060         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59061         for (size_t i = 0; i < ret_var.datalen; i++) {
59062                 int64_t ret_conv_8_conv = ret_var.data[i];
59063                 ret_arr_ptr[i] = ret_conv_8_conv;
59064         }
59065         
59066         FREE(ret_var.data);
59067         return ret_arr;
59068 }
59069
59070 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
59071         LDKPaymentParameters this_ptr_conv;
59072         this_ptr_conv.inner = untag_ptr(this_ptr);
59073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59075         this_ptr_conv.is_owned = false;
59076         LDKCVec_u64Z val_constr;
59077         val_constr.datalen = val->arr_len;
59078         if (val_constr.datalen > 0)
59079                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59080         else
59081                 val_constr.data = NULL;
59082         int64_t* val_vals = val->elems;
59083         for (size_t i = 0; i < val_constr.datalen; i++) {
59084                 int64_t val_conv_8 = val_vals[i];
59085                 val_constr.data[i] = val_conv_8;
59086         }
59087         FREE(val);
59088         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
59089 }
59090
59091 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) {
59092         void* payee_arg_ptr = untag_ptr(payee_arg);
59093         CHECK_ACCESS(payee_arg_ptr);
59094         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
59095         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
59096         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
59097         CHECK_ACCESS(expiry_time_arg_ptr);
59098         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
59099         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
59100         LDKCVec_u64Z previously_failed_channels_arg_constr;
59101         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
59102         if (previously_failed_channels_arg_constr.datalen > 0)
59103                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59104         else
59105                 previously_failed_channels_arg_constr.data = NULL;
59106         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
59107         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
59108                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
59109                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
59110         }
59111         FREE(previously_failed_channels_arg);
59112         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);
59113         uint64_t ret_ref = 0;
59114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59116         return ret_ref;
59117 }
59118
59119 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
59120         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
59121         uint64_t ret_ref = 0;
59122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59124         return ret_ref;
59125 }
59126 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
59127         LDKPaymentParameters arg_conv;
59128         arg_conv.inner = untag_ptr(arg);
59129         arg_conv.is_owned = ptr_is_owned(arg);
59130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59131         arg_conv.is_owned = false;
59132         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
59133         return ret_conv;
59134 }
59135
59136 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
59137         LDKPaymentParameters orig_conv;
59138         orig_conv.inner = untag_ptr(orig);
59139         orig_conv.is_owned = ptr_is_owned(orig);
59140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59141         orig_conv.is_owned = false;
59142         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
59143         uint64_t ret_ref = 0;
59144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59146         return ret_ref;
59147 }
59148
59149 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
59150         LDKPaymentParameters o_conv;
59151         o_conv.inner = untag_ptr(o);
59152         o_conv.is_owned = ptr_is_owned(o);
59153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59154         o_conv.is_owned = false;
59155         int64_t ret_conv = PaymentParameters_hash(&o_conv);
59156         return ret_conv;
59157 }
59158
59159 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
59160         LDKPaymentParameters a_conv;
59161         a_conv.inner = untag_ptr(a);
59162         a_conv.is_owned = ptr_is_owned(a);
59163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59164         a_conv.is_owned = false;
59165         LDKPaymentParameters b_conv;
59166         b_conv.inner = untag_ptr(b);
59167         b_conv.is_owned = ptr_is_owned(b);
59168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59169         b_conv.is_owned = false;
59170         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
59171         return ret_conv;
59172 }
59173
59174 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
59175         LDKPaymentParameters obj_conv;
59176         obj_conv.inner = untag_ptr(obj);
59177         obj_conv.is_owned = ptr_is_owned(obj);
59178         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59179         obj_conv.is_owned = false;
59180         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
59181         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59182         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59183         CVec_u8Z_free(ret_var);
59184         return ret_arr;
59185 }
59186
59187 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
59188         LDKu8slice ser_ref;
59189         ser_ref.datalen = ser->arr_len;
59190         ser_ref.data = ser->elems;
59191         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
59192         *ret_conv = PaymentParameters_read(ser_ref, arg);
59193         FREE(ser);
59194         return tag_ptr(ret_conv, true);
59195 }
59196
59197 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) {
59198         LDKPublicKey payee_pubkey_ref;
59199         CHECK(payee_pubkey->arr_len == 33);
59200         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
59201         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
59202         uint64_t ret_ref = 0;
59203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59205         return ret_ref;
59206 }
59207
59208 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) {
59209         LDKPublicKey payee_pubkey_ref;
59210         CHECK(payee_pubkey->arr_len == 33);
59211         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
59212         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
59213         uint64_t ret_ref = 0;
59214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59216         return ret_ref;
59217 }
59218
59219 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
59220         LDKBolt12Invoice invoice_conv;
59221         invoice_conv.inner = untag_ptr(invoice);
59222         invoice_conv.is_owned = ptr_is_owned(invoice);
59223         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
59224         invoice_conv.is_owned = false;
59225         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
59226         uint64_t ret_ref = 0;
59227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59229         return ret_ref;
59230 }
59231
59232 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
59233         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
59234         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
59235         if (blinded_route_hints_constr.datalen > 0)
59236                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
59237         else
59238                 blinded_route_hints_constr.data = NULL;
59239         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
59240         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
59241                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
59242                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
59243                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
59244                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
59245                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
59246                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
59247         }
59248         FREE(blinded_route_hints);
59249         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
59250         uint64_t ret_ref = 0;
59251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59253         return ret_ref;
59254 }
59255
59256 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
59257         if (!ptr_is_owned(this_ptr)) return;
59258         void* this_ptr_ptr = untag_ptr(this_ptr);
59259         CHECK_ACCESS(this_ptr_ptr);
59260         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
59261         FREE(untag_ptr(this_ptr));
59262         Payee_free(this_ptr_conv);
59263 }
59264
59265 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
59266         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59267         *ret_copy = Payee_clone(arg);
59268         uint64_t ret_ref = tag_ptr(ret_copy, true);
59269         return ret_ref;
59270 }
59271 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
59272         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
59273         int64_t ret_conv = Payee_clone_ptr(arg_conv);
59274         return ret_conv;
59275 }
59276
59277 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
59278         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
59279         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59280         *ret_copy = Payee_clone(orig_conv);
59281         uint64_t ret_ref = tag_ptr(ret_copy, true);
59282         return ret_ref;
59283 }
59284
59285 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
59286         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
59287         route_hints_constr.datalen = route_hints->arr_len;
59288         if (route_hints_constr.datalen > 0)
59289                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
59290         else
59291                 route_hints_constr.data = NULL;
59292         uint64_t* route_hints_vals = route_hints->elems;
59293         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
59294                 uint64_t route_hints_conv_37 = route_hints_vals[l];
59295                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
59296                 CHECK_ACCESS(route_hints_conv_37_ptr);
59297                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
59298                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
59299                 route_hints_constr.data[l] = route_hints_conv_37_conv;
59300         }
59301         FREE(route_hints);
59302         LDKBolt12InvoiceFeatures features_conv;
59303         features_conv.inner = untag_ptr(features);
59304         features_conv.is_owned = ptr_is_owned(features);
59305         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
59306         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
59307         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59308         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
59309         uint64_t ret_ref = tag_ptr(ret_copy, true);
59310         return ret_ref;
59311 }
59312
59313 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) {
59314         LDKPublicKey node_id_ref;
59315         CHECK(node_id->arr_len == 33);
59316         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59317         LDKCVec_RouteHintZ route_hints_constr;
59318         route_hints_constr.datalen = route_hints->arr_len;
59319         if (route_hints_constr.datalen > 0)
59320                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
59321         else
59322                 route_hints_constr.data = NULL;
59323         uint64_t* route_hints_vals = route_hints->elems;
59324         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
59325                 uint64_t route_hints_conv_11 = route_hints_vals[l];
59326                 LDKRouteHint route_hints_conv_11_conv;
59327                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
59328                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
59329                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
59330                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
59331                 route_hints_constr.data[l] = route_hints_conv_11_conv;
59332         }
59333         FREE(route_hints);
59334         LDKBolt11InvoiceFeatures features_conv;
59335         features_conv.inner = untag_ptr(features);
59336         features_conv.is_owned = ptr_is_owned(features);
59337         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
59338         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
59339         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59340         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
59341         uint64_t ret_ref = tag_ptr(ret_copy, true);
59342         return ret_ref;
59343 }
59344
59345 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
59346         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
59347         int64_t ret_conv = Payee_hash(o_conv);
59348         return ret_conv;
59349 }
59350
59351 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
59352         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
59353         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
59354         jboolean ret_conv = Payee_eq(a_conv, b_conv);
59355         return ret_conv;
59356 }
59357
59358 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
59359         LDKRouteHint this_obj_conv;
59360         this_obj_conv.inner = untag_ptr(this_obj);
59361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59363         RouteHint_free(this_obj_conv);
59364 }
59365
59366 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
59367         LDKRouteHint this_ptr_conv;
59368         this_ptr_conv.inner = untag_ptr(this_ptr);
59369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59371         this_ptr_conv.is_owned = false;
59372         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
59373         uint64_tArray ret_arr = NULL;
59374         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59375         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59376         for (size_t o = 0; o < ret_var.datalen; o++) {
59377                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
59378                 uint64_t ret_conv_14_ref = 0;
59379                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
59380                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
59381                 ret_arr_ptr[o] = ret_conv_14_ref;
59382         }
59383         
59384         FREE(ret_var.data);
59385         return ret_arr;
59386 }
59387
59388 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
59389         LDKRouteHint this_ptr_conv;
59390         this_ptr_conv.inner = untag_ptr(this_ptr);
59391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59393         this_ptr_conv.is_owned = false;
59394         LDKCVec_RouteHintHopZ val_constr;
59395         val_constr.datalen = val->arr_len;
59396         if (val_constr.datalen > 0)
59397                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
59398         else
59399                 val_constr.data = NULL;
59400         uint64_t* val_vals = val->elems;
59401         for (size_t o = 0; o < val_constr.datalen; o++) {
59402                 uint64_t val_conv_14 = val_vals[o];
59403                 LDKRouteHintHop val_conv_14_conv;
59404                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
59405                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
59406                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
59407                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
59408                 val_constr.data[o] = val_conv_14_conv;
59409         }
59410         FREE(val);
59411         RouteHint_set_a(&this_ptr_conv, val_constr);
59412 }
59413
59414 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
59415         LDKCVec_RouteHintHopZ a_arg_constr;
59416         a_arg_constr.datalen = a_arg->arr_len;
59417         if (a_arg_constr.datalen > 0)
59418                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
59419         else
59420                 a_arg_constr.data = NULL;
59421         uint64_t* a_arg_vals = a_arg->elems;
59422         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
59423                 uint64_t a_arg_conv_14 = a_arg_vals[o];
59424                 LDKRouteHintHop a_arg_conv_14_conv;
59425                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
59426                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
59427                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
59428                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
59429                 a_arg_constr.data[o] = a_arg_conv_14_conv;
59430         }
59431         FREE(a_arg);
59432         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
59433         uint64_t ret_ref = 0;
59434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59436         return ret_ref;
59437 }
59438
59439 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
59440         LDKRouteHint ret_var = RouteHint_clone(arg);
59441         uint64_t ret_ref = 0;
59442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59444         return ret_ref;
59445 }
59446 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
59447         LDKRouteHint arg_conv;
59448         arg_conv.inner = untag_ptr(arg);
59449         arg_conv.is_owned = ptr_is_owned(arg);
59450         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59451         arg_conv.is_owned = false;
59452         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
59453         return ret_conv;
59454 }
59455
59456 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
59457         LDKRouteHint orig_conv;
59458         orig_conv.inner = untag_ptr(orig);
59459         orig_conv.is_owned = ptr_is_owned(orig);
59460         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59461         orig_conv.is_owned = false;
59462         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
59463         uint64_t ret_ref = 0;
59464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59466         return ret_ref;
59467 }
59468
59469 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
59470         LDKRouteHint o_conv;
59471         o_conv.inner = untag_ptr(o);
59472         o_conv.is_owned = ptr_is_owned(o);
59473         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59474         o_conv.is_owned = false;
59475         int64_t ret_conv = RouteHint_hash(&o_conv);
59476         return ret_conv;
59477 }
59478
59479 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
59480         LDKRouteHint a_conv;
59481         a_conv.inner = untag_ptr(a);
59482         a_conv.is_owned = ptr_is_owned(a);
59483         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59484         a_conv.is_owned = false;
59485         LDKRouteHint b_conv;
59486         b_conv.inner = untag_ptr(b);
59487         b_conv.is_owned = ptr_is_owned(b);
59488         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59489         b_conv.is_owned = false;
59490         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
59491         return ret_conv;
59492 }
59493
59494 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
59495         LDKRouteHint obj_conv;
59496         obj_conv.inner = untag_ptr(obj);
59497         obj_conv.is_owned = ptr_is_owned(obj);
59498         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59499         obj_conv.is_owned = false;
59500         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
59501         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59502         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59503         CVec_u8Z_free(ret_var);
59504         return ret_arr;
59505 }
59506
59507 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
59508         LDKu8slice ser_ref;
59509         ser_ref.datalen = ser->arr_len;
59510         ser_ref.data = ser->elems;
59511         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
59512         *ret_conv = RouteHint_read(ser_ref);
59513         FREE(ser);
59514         return tag_ptr(ret_conv, true);
59515 }
59516
59517 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
59518         LDKRouteHintHop this_obj_conv;
59519         this_obj_conv.inner = untag_ptr(this_obj);
59520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59522         RouteHintHop_free(this_obj_conv);
59523 }
59524
59525 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
59526         LDKRouteHintHop this_ptr_conv;
59527         this_ptr_conv.inner = untag_ptr(this_ptr);
59528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59530         this_ptr_conv.is_owned = false;
59531         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59532         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
59533         return ret_arr;
59534 }
59535
59536 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
59537         LDKRouteHintHop this_ptr_conv;
59538         this_ptr_conv.inner = untag_ptr(this_ptr);
59539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59541         this_ptr_conv.is_owned = false;
59542         LDKPublicKey val_ref;
59543         CHECK(val->arr_len == 33);
59544         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
59545         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
59546 }
59547
59548 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
59549         LDKRouteHintHop this_ptr_conv;
59550         this_ptr_conv.inner = untag_ptr(this_ptr);
59551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59553         this_ptr_conv.is_owned = false;
59554         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
59555         return ret_conv;
59556 }
59557
59558 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
59559         LDKRouteHintHop this_ptr_conv;
59560         this_ptr_conv.inner = untag_ptr(this_ptr);
59561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59563         this_ptr_conv.is_owned = false;
59564         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
59565 }
59566
59567 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
59568         LDKRouteHintHop this_ptr_conv;
59569         this_ptr_conv.inner = untag_ptr(this_ptr);
59570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59572         this_ptr_conv.is_owned = false;
59573         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
59574         uint64_t ret_ref = 0;
59575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59577         return ret_ref;
59578 }
59579
59580 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
59581         LDKRouteHintHop this_ptr_conv;
59582         this_ptr_conv.inner = untag_ptr(this_ptr);
59583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59585         this_ptr_conv.is_owned = false;
59586         LDKRoutingFees val_conv;
59587         val_conv.inner = untag_ptr(val);
59588         val_conv.is_owned = ptr_is_owned(val);
59589         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59590         val_conv = RoutingFees_clone(&val_conv);
59591         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
59592 }
59593
59594 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
59595         LDKRouteHintHop this_ptr_conv;
59596         this_ptr_conv.inner = untag_ptr(this_ptr);
59597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59599         this_ptr_conv.is_owned = false;
59600         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
59601         return ret_conv;
59602 }
59603
59604 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
59605         LDKRouteHintHop this_ptr_conv;
59606         this_ptr_conv.inner = untag_ptr(this_ptr);
59607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59609         this_ptr_conv.is_owned = false;
59610         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
59611 }
59612
59613 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
59614         LDKRouteHintHop this_ptr_conv;
59615         this_ptr_conv.inner = untag_ptr(this_ptr);
59616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59618         this_ptr_conv.is_owned = false;
59619         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59620         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
59621         uint64_t ret_ref = tag_ptr(ret_copy, true);
59622         return ret_ref;
59623 }
59624
59625 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
59626         LDKRouteHintHop this_ptr_conv;
59627         this_ptr_conv.inner = untag_ptr(this_ptr);
59628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59630         this_ptr_conv.is_owned = false;
59631         void* val_ptr = untag_ptr(val);
59632         CHECK_ACCESS(val_ptr);
59633         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
59634         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
59635         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
59636 }
59637
59638 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
59639         LDKRouteHintHop this_ptr_conv;
59640         this_ptr_conv.inner = untag_ptr(this_ptr);
59641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59643         this_ptr_conv.is_owned = false;
59644         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59645         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
59646         uint64_t ret_ref = tag_ptr(ret_copy, true);
59647         return ret_ref;
59648 }
59649
59650 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
59651         LDKRouteHintHop this_ptr_conv;
59652         this_ptr_conv.inner = untag_ptr(this_ptr);
59653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59655         this_ptr_conv.is_owned = false;
59656         void* val_ptr = untag_ptr(val);
59657         CHECK_ACCESS(val_ptr);
59658         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
59659         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
59660         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
59661 }
59662
59663 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) {
59664         LDKPublicKey src_node_id_arg_ref;
59665         CHECK(src_node_id_arg->arr_len == 33);
59666         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
59667         LDKRoutingFees fees_arg_conv;
59668         fees_arg_conv.inner = untag_ptr(fees_arg);
59669         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
59670         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
59671         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
59672         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
59673         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
59674         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
59675         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
59676         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
59677         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
59678         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
59679         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
59680         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);
59681         uint64_t ret_ref = 0;
59682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59684         return ret_ref;
59685 }
59686
59687 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
59688         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
59689         uint64_t ret_ref = 0;
59690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59692         return ret_ref;
59693 }
59694 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
59695         LDKRouteHintHop arg_conv;
59696         arg_conv.inner = untag_ptr(arg);
59697         arg_conv.is_owned = ptr_is_owned(arg);
59698         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59699         arg_conv.is_owned = false;
59700         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
59701         return ret_conv;
59702 }
59703
59704 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
59705         LDKRouteHintHop orig_conv;
59706         orig_conv.inner = untag_ptr(orig);
59707         orig_conv.is_owned = ptr_is_owned(orig);
59708         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59709         orig_conv.is_owned = false;
59710         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
59711         uint64_t ret_ref = 0;
59712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59714         return ret_ref;
59715 }
59716
59717 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
59718         LDKRouteHintHop o_conv;
59719         o_conv.inner = untag_ptr(o);
59720         o_conv.is_owned = ptr_is_owned(o);
59721         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59722         o_conv.is_owned = false;
59723         int64_t ret_conv = RouteHintHop_hash(&o_conv);
59724         return ret_conv;
59725 }
59726
59727 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
59728         LDKRouteHintHop a_conv;
59729         a_conv.inner = untag_ptr(a);
59730         a_conv.is_owned = ptr_is_owned(a);
59731         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59732         a_conv.is_owned = false;
59733         LDKRouteHintHop b_conv;
59734         b_conv.inner = untag_ptr(b);
59735         b_conv.is_owned = ptr_is_owned(b);
59736         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59737         b_conv.is_owned = false;
59738         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
59739         return ret_conv;
59740 }
59741
59742 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
59743         LDKRouteHintHop obj_conv;
59744         obj_conv.inner = untag_ptr(obj);
59745         obj_conv.is_owned = ptr_is_owned(obj);
59746         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59747         obj_conv.is_owned = false;
59748         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
59749         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59750         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59751         CVec_u8Z_free(ret_var);
59752         return ret_arr;
59753 }
59754
59755 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
59756         LDKu8slice ser_ref;
59757         ser_ref.datalen = ser->arr_len;
59758         ser_ref.data = ser->elems;
59759         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
59760         *ret_conv = RouteHintHop_read(ser_ref);
59761         FREE(ser);
59762         return tag_ptr(ret_conv, true);
59763 }
59764
59765 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) {
59766         LDKPublicKey our_node_pubkey_ref;
59767         CHECK(our_node_pubkey->arr_len == 33);
59768         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
59769         LDKRouteParameters route_params_conv;
59770         route_params_conv.inner = untag_ptr(route_params);
59771         route_params_conv.is_owned = ptr_is_owned(route_params);
59772         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
59773         route_params_conv.is_owned = false;
59774         LDKNetworkGraph network_graph_conv;
59775         network_graph_conv.inner = untag_ptr(network_graph);
59776         network_graph_conv.is_owned = ptr_is_owned(network_graph);
59777         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
59778         network_graph_conv.is_owned = false;
59779         LDKCVec_ChannelDetailsZ first_hops_constr;
59780         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
59781         if (first_hops != 0) {
59782                 first_hops_constr.datalen = first_hops->arr_len;
59783                 if (first_hops_constr.datalen > 0)
59784                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
59785                 else
59786                         first_hops_constr.data = NULL;
59787                 uint64_t* first_hops_vals = first_hops->elems;
59788                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
59789                         uint64_t first_hops_conv_16 = first_hops_vals[q];
59790                         LDKChannelDetails first_hops_conv_16_conv;
59791                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
59792                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
59793                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
59794                         first_hops_conv_16_conv.is_owned = false;
59795                         first_hops_constr.data[q] = first_hops_conv_16_conv;
59796                 }
59797                 FREE(first_hops);
59798                 first_hops_ptr = &first_hops_constr;
59799         }
59800         void* logger_ptr = untag_ptr(logger);
59801         CHECK_ACCESS(logger_ptr);
59802         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
59803         if (logger_conv.free == LDKLogger_JCalls_free) {
59804                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59805                 LDKLogger_JCalls_cloned(&logger_conv);
59806         }
59807         void* scorer_ptr = untag_ptr(scorer);
59808         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
59809         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
59810         LDKProbabilisticScoringFeeParameters score_params_conv;
59811         score_params_conv.inner = untag_ptr(score_params);
59812         score_params_conv.is_owned = ptr_is_owned(score_params);
59813         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
59814         score_params_conv.is_owned = false;
59815         uint8_t random_seed_bytes_arr[32];
59816         CHECK(random_seed_bytes->arr_len == 32);
59817         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
59818         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
59819         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
59820         *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);
59821         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
59822         return tag_ptr(ret_conv, true);
59823 }
59824
59825 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) {
59826         LDKPublicKey our_node_pubkey_ref;
59827         CHECK(our_node_pubkey->arr_len == 33);
59828         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
59829         LDKCVec_PublicKeyZ hops_constr;
59830         hops_constr.datalen = hops->arr_len;
59831         if (hops_constr.datalen > 0)
59832                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
59833         else
59834                 hops_constr.data = NULL;
59835         int8_tArray* hops_vals = (void*) hops->elems;
59836         for (size_t m = 0; m < hops_constr.datalen; m++) {
59837                 int8_tArray hops_conv_12 = hops_vals[m];
59838                 LDKPublicKey hops_conv_12_ref;
59839                 CHECK(hops_conv_12->arr_len == 33);
59840                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
59841                 hops_constr.data[m] = hops_conv_12_ref;
59842         }
59843         FREE(hops);
59844         LDKRouteParameters route_params_conv;
59845         route_params_conv.inner = untag_ptr(route_params);
59846         route_params_conv.is_owned = ptr_is_owned(route_params);
59847         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
59848         route_params_conv.is_owned = false;
59849         LDKNetworkGraph network_graph_conv;
59850         network_graph_conv.inner = untag_ptr(network_graph);
59851         network_graph_conv.is_owned = ptr_is_owned(network_graph);
59852         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
59853         network_graph_conv.is_owned = false;
59854         void* logger_ptr = untag_ptr(logger);
59855         CHECK_ACCESS(logger_ptr);
59856         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
59857         if (logger_conv.free == LDKLogger_JCalls_free) {
59858                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59859                 LDKLogger_JCalls_cloned(&logger_conv);
59860         }
59861         uint8_t random_seed_bytes_arr[32];
59862         CHECK(random_seed_bytes->arr_len == 32);
59863         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
59864         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
59865         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
59866         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
59867         return tag_ptr(ret_conv, true);
59868 }
59869
59870 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
59871         if (!ptr_is_owned(this_ptr)) return;
59872         void* this_ptr_ptr = untag_ptr(this_ptr);
59873         CHECK_ACCESS(this_ptr_ptr);
59874         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
59875         FREE(untag_ptr(this_ptr));
59876         ScoreLookUp_free(this_ptr_conv);
59877 }
59878
59879 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
59880         if (!ptr_is_owned(this_ptr)) return;
59881         void* this_ptr_ptr = untag_ptr(this_ptr);
59882         CHECK_ACCESS(this_ptr_ptr);
59883         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
59884         FREE(untag_ptr(this_ptr));
59885         ScoreUpdate_free(this_ptr_conv);
59886 }
59887
59888 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
59889         if (!ptr_is_owned(this_ptr)) return;
59890         void* this_ptr_ptr = untag_ptr(this_ptr);
59891         CHECK_ACCESS(this_ptr_ptr);
59892         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
59893         FREE(untag_ptr(this_ptr));
59894         Score_free(this_ptr_conv);
59895 }
59896
59897 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
59898         if (!ptr_is_owned(this_ptr)) return;
59899         void* this_ptr_ptr = untag_ptr(this_ptr);
59900         CHECK_ACCESS(this_ptr_ptr);
59901         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
59902         FREE(untag_ptr(this_ptr));
59903         LockableScore_free(this_ptr_conv);
59904 }
59905
59906 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
59907         if (!ptr_is_owned(this_ptr)) return;
59908         void* this_ptr_ptr = untag_ptr(this_ptr);
59909         CHECK_ACCESS(this_ptr_ptr);
59910         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
59911         FREE(untag_ptr(this_ptr));
59912         WriteableScore_free(this_ptr_conv);
59913 }
59914
59915 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
59916         LDKMultiThreadedLockableScore this_obj_conv;
59917         this_obj_conv.inner = untag_ptr(this_obj);
59918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59920         MultiThreadedLockableScore_free(this_obj_conv);
59921 }
59922
59923 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
59924         LDKMultiThreadedLockableScore this_arg_conv;
59925         this_arg_conv.inner = untag_ptr(this_arg);
59926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59928         this_arg_conv.is_owned = false;
59929         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
59930         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
59931         return tag_ptr(ret_ret, true);
59932 }
59933
59934 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
59935         LDKMultiThreadedLockableScore obj_conv;
59936         obj_conv.inner = untag_ptr(obj);
59937         obj_conv.is_owned = ptr_is_owned(obj);
59938         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59939         obj_conv.is_owned = false;
59940         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
59941         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59942         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59943         CVec_u8Z_free(ret_var);
59944         return ret_arr;
59945 }
59946
59947 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
59948         LDKMultiThreadedLockableScore this_arg_conv;
59949         this_arg_conv.inner = untag_ptr(this_arg);
59950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59952         this_arg_conv.is_owned = false;
59953         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
59954         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
59955         return tag_ptr(ret_ret, true);
59956 }
59957
59958 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
59959         void* score_ptr = untag_ptr(score);
59960         CHECK_ACCESS(score_ptr);
59961         LDKScore score_conv = *(LDKScore*)(score_ptr);
59962         if (score_conv.free == LDKScore_JCalls_free) {
59963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59964                 LDKScore_JCalls_cloned(&score_conv);
59965         }
59966         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
59967         uint64_t ret_ref = 0;
59968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59970         return ret_ref;
59971 }
59972
59973 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
59974         LDKMultiThreadedScoreLockRead this_obj_conv;
59975         this_obj_conv.inner = untag_ptr(this_obj);
59976         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59978         MultiThreadedScoreLockRead_free(this_obj_conv);
59979 }
59980
59981 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
59982         LDKMultiThreadedScoreLockWrite this_obj_conv;
59983         this_obj_conv.inner = untag_ptr(this_obj);
59984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59986         MultiThreadedScoreLockWrite_free(this_obj_conv);
59987 }
59988
59989 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
59990         LDKMultiThreadedScoreLockRead this_arg_conv;
59991         this_arg_conv.inner = untag_ptr(this_arg);
59992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59994         this_arg_conv.is_owned = false;
59995         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
59996         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
59997         return tag_ptr(ret_ret, true);
59998 }
59999
60000 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
60001         LDKMultiThreadedScoreLockWrite obj_conv;
60002         obj_conv.inner = untag_ptr(obj);
60003         obj_conv.is_owned = ptr_is_owned(obj);
60004         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60005         obj_conv.is_owned = false;
60006         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
60007         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60008         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60009         CVec_u8Z_free(ret_var);
60010         return ret_arr;
60011 }
60012
60013 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
60014         LDKMultiThreadedScoreLockWrite this_arg_conv;
60015         this_arg_conv.inner = untag_ptr(this_arg);
60016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60018         this_arg_conv.is_owned = false;
60019         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60020         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
60021         return tag_ptr(ret_ret, true);
60022 }
60023
60024 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
60025         LDKChannelUsage this_obj_conv;
60026         this_obj_conv.inner = untag_ptr(this_obj);
60027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60029         ChannelUsage_free(this_obj_conv);
60030 }
60031
60032 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
60033         LDKChannelUsage this_ptr_conv;
60034         this_ptr_conv.inner = untag_ptr(this_ptr);
60035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60037         this_ptr_conv.is_owned = false;
60038         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
60039         return ret_conv;
60040 }
60041
60042 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
60043         LDKChannelUsage this_ptr_conv;
60044         this_ptr_conv.inner = untag_ptr(this_ptr);
60045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60047         this_ptr_conv.is_owned = false;
60048         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
60049 }
60050
60051 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
60052         LDKChannelUsage this_ptr_conv;
60053         this_ptr_conv.inner = untag_ptr(this_ptr);
60054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60056         this_ptr_conv.is_owned = false;
60057         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
60058         return ret_conv;
60059 }
60060
60061 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
60062         LDKChannelUsage this_ptr_conv;
60063         this_ptr_conv.inner = untag_ptr(this_ptr);
60064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60066         this_ptr_conv.is_owned = false;
60067         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
60068 }
60069
60070 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
60071         LDKChannelUsage this_ptr_conv;
60072         this_ptr_conv.inner = untag_ptr(this_ptr);
60073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60075         this_ptr_conv.is_owned = false;
60076         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
60077         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
60078         uint64_t ret_ref = tag_ptr(ret_copy, true);
60079         return ret_ref;
60080 }
60081
60082 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
60083         LDKChannelUsage this_ptr_conv;
60084         this_ptr_conv.inner = untag_ptr(this_ptr);
60085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60087         this_ptr_conv.is_owned = false;
60088         void* val_ptr = untag_ptr(val);
60089         CHECK_ACCESS(val_ptr);
60090         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
60091         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
60092         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
60093 }
60094
60095 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) {
60096         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
60097         CHECK_ACCESS(effective_capacity_arg_ptr);
60098         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
60099         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
60100         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
60101         uint64_t ret_ref = 0;
60102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60104         return ret_ref;
60105 }
60106
60107 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
60108         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
60109         uint64_t ret_ref = 0;
60110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60112         return ret_ref;
60113 }
60114 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
60115         LDKChannelUsage arg_conv;
60116         arg_conv.inner = untag_ptr(arg);
60117         arg_conv.is_owned = ptr_is_owned(arg);
60118         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60119         arg_conv.is_owned = false;
60120         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
60121         return ret_conv;
60122 }
60123
60124 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
60125         LDKChannelUsage orig_conv;
60126         orig_conv.inner = untag_ptr(orig);
60127         orig_conv.is_owned = ptr_is_owned(orig);
60128         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60129         orig_conv.is_owned = false;
60130         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
60131         uint64_t ret_ref = 0;
60132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60134         return ret_ref;
60135 }
60136
60137 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
60138         LDKFixedPenaltyScorer this_obj_conv;
60139         this_obj_conv.inner = untag_ptr(this_obj);
60140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60142         FixedPenaltyScorer_free(this_obj_conv);
60143 }
60144
60145 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
60146         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
60147         uint64_t ret_ref = 0;
60148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60150         return ret_ref;
60151 }
60152 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
60153         LDKFixedPenaltyScorer arg_conv;
60154         arg_conv.inner = untag_ptr(arg);
60155         arg_conv.is_owned = ptr_is_owned(arg);
60156         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60157         arg_conv.is_owned = false;
60158         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
60159         return ret_conv;
60160 }
60161
60162 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
60163         LDKFixedPenaltyScorer orig_conv;
60164         orig_conv.inner = untag_ptr(orig);
60165         orig_conv.is_owned = ptr_is_owned(orig);
60166         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60167         orig_conv.is_owned = false;
60168         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
60169         uint64_t ret_ref = 0;
60170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60172         return ret_ref;
60173 }
60174
60175 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
60176         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
60177         uint64_t ret_ref = 0;
60178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60180         return ret_ref;
60181 }
60182
60183 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
60184         LDKFixedPenaltyScorer this_arg_conv;
60185         this_arg_conv.inner = untag_ptr(this_arg);
60186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60188         this_arg_conv.is_owned = false;
60189         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
60190         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
60191         return tag_ptr(ret_ret, true);
60192 }
60193
60194 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
60195         LDKFixedPenaltyScorer this_arg_conv;
60196         this_arg_conv.inner = untag_ptr(this_arg);
60197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60199         this_arg_conv.is_owned = false;
60200         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60201         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
60202         return tag_ptr(ret_ret, true);
60203 }
60204
60205 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
60206         LDKFixedPenaltyScorer obj_conv;
60207         obj_conv.inner = untag_ptr(obj);
60208         obj_conv.is_owned = ptr_is_owned(obj);
60209         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60210         obj_conv.is_owned = false;
60211         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
60212         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60213         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60214         CVec_u8Z_free(ret_var);
60215         return ret_arr;
60216 }
60217
60218 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
60219         LDKu8slice ser_ref;
60220         ser_ref.datalen = ser->arr_len;
60221         ser_ref.data = ser->elems;
60222         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
60223         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
60224         FREE(ser);
60225         return tag_ptr(ret_conv, true);
60226 }
60227
60228 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
60229         LDKProbabilisticScorer this_obj_conv;
60230         this_obj_conv.inner = untag_ptr(this_obj);
60231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60233         ProbabilisticScorer_free(this_obj_conv);
60234 }
60235
60236 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
60237         LDKProbabilisticScoringFeeParameters this_obj_conv;
60238         this_obj_conv.inner = untag_ptr(this_obj);
60239         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60241         ProbabilisticScoringFeeParameters_free(this_obj_conv);
60242 }
60243
60244 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
60245         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60246         this_ptr_conv.inner = untag_ptr(this_ptr);
60247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60249         this_ptr_conv.is_owned = false;
60250         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
60251         return ret_conv;
60252 }
60253
60254 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
60255         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60256         this_ptr_conv.inner = untag_ptr(this_ptr);
60257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60259         this_ptr_conv.is_owned = false;
60260         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
60261 }
60262
60263 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) {
60264         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60265         this_ptr_conv.inner = untag_ptr(this_ptr);
60266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60268         this_ptr_conv.is_owned = false;
60269         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
60270         return ret_conv;
60271 }
60272
60273 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) {
60274         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60275         this_ptr_conv.inner = untag_ptr(this_ptr);
60276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60278         this_ptr_conv.is_owned = false;
60279         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60280 }
60281
60282 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
60283         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60284         this_ptr_conv.inner = untag_ptr(this_ptr);
60285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60287         this_ptr_conv.is_owned = false;
60288         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
60289         return ret_conv;
60290 }
60291
60292 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) {
60293         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60294         this_ptr_conv.inner = untag_ptr(this_ptr);
60295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60297         this_ptr_conv.is_owned = false;
60298         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
60299 }
60300
60301 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) {
60302         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60303         this_ptr_conv.inner = untag_ptr(this_ptr);
60304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60306         this_ptr_conv.is_owned = false;
60307         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
60308         return ret_conv;
60309 }
60310
60311 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) {
60312         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60313         this_ptr_conv.inner = untag_ptr(this_ptr);
60314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60316         this_ptr_conv.is_owned = false;
60317         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60318 }
60319
60320 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) {
60321         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60322         this_ptr_conv.inner = untag_ptr(this_ptr);
60323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60325         this_ptr_conv.is_owned = false;
60326         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
60327         return ret_conv;
60328 }
60329
60330 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) {
60331         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60332         this_ptr_conv.inner = untag_ptr(this_ptr);
60333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60335         this_ptr_conv.is_owned = false;
60336         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
60337 }
60338
60339 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) {
60340         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60341         this_ptr_conv.inner = untag_ptr(this_ptr);
60342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60344         this_ptr_conv.is_owned = false;
60345         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
60346         return ret_conv;
60347 }
60348
60349 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) {
60350         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60351         this_ptr_conv.inner = untag_ptr(this_ptr);
60352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60354         this_ptr_conv.is_owned = false;
60355         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60356 }
60357
60358 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
60359         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60360         this_ptr_conv.inner = untag_ptr(this_ptr);
60361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60363         this_ptr_conv.is_owned = false;
60364         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
60365         return ret_conv;
60366 }
60367
60368 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) {
60369         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60370         this_ptr_conv.inner = untag_ptr(this_ptr);
60371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60373         this_ptr_conv.is_owned = false;
60374         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
60375 }
60376
60377 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
60378         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60379         this_ptr_conv.inner = untag_ptr(this_ptr);
60380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60382         this_ptr_conv.is_owned = false;
60383         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
60384         return ret_conv;
60385 }
60386
60387 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) {
60388         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60389         this_ptr_conv.inner = untag_ptr(this_ptr);
60390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60392         this_ptr_conv.is_owned = false;
60393         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
60394 }
60395
60396 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
60397         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60398         this_ptr_conv.inner = untag_ptr(this_ptr);
60399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60401         this_ptr_conv.is_owned = false;
60402         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
60403         return ret_conv;
60404 }
60405
60406 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
60407         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60408         this_ptr_conv.inner = untag_ptr(this_ptr);
60409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60411         this_ptr_conv.is_owned = false;
60412         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
60413 }
60414
60415 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
60416         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
60417         uint64_t ret_ref = 0;
60418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60420         return ret_ref;
60421 }
60422 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
60423         LDKProbabilisticScoringFeeParameters arg_conv;
60424         arg_conv.inner = untag_ptr(arg);
60425         arg_conv.is_owned = ptr_is_owned(arg);
60426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60427         arg_conv.is_owned = false;
60428         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
60429         return ret_conv;
60430 }
60431
60432 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
60433         LDKProbabilisticScoringFeeParameters orig_conv;
60434         orig_conv.inner = untag_ptr(orig);
60435         orig_conv.is_owned = ptr_is_owned(orig);
60436         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60437         orig_conv.is_owned = false;
60438         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
60439         uint64_t ret_ref = 0;
60440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60442         return ret_ref;
60443 }
60444
60445 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
60446         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
60447         uint64_t ret_ref = 0;
60448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60450         return ret_ref;
60451 }
60452
60453 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
60454         LDKProbabilisticScoringFeeParameters this_arg_conv;
60455         this_arg_conv.inner = untag_ptr(this_arg);
60456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60458         this_arg_conv.is_owned = false;
60459         LDKNodeId node_id_conv;
60460         node_id_conv.inner = untag_ptr(node_id);
60461         node_id_conv.is_owned = ptr_is_owned(node_id);
60462         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
60463         node_id_conv.is_owned = false;
60464         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
60465 }
60466
60467 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
60468         LDKProbabilisticScoringFeeParameters this_arg_conv;
60469         this_arg_conv.inner = untag_ptr(this_arg);
60470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60472         this_arg_conv.is_owned = false;
60473         LDKCVec_NodeIdZ node_ids_constr;
60474         node_ids_constr.datalen = node_ids->arr_len;
60475         if (node_ids_constr.datalen > 0)
60476                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
60477         else
60478                 node_ids_constr.data = NULL;
60479         uint64_t* node_ids_vals = node_ids->elems;
60480         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
60481                 uint64_t node_ids_conv_8 = node_ids_vals[i];
60482                 LDKNodeId node_ids_conv_8_conv;
60483                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
60484                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
60485                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
60486                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
60487                 node_ids_constr.data[i] = node_ids_conv_8_conv;
60488         }
60489         FREE(node_ids);
60490         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
60491 }
60492
60493 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
60494         LDKProbabilisticScoringFeeParameters this_arg_conv;
60495         this_arg_conv.inner = untag_ptr(this_arg);
60496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60498         this_arg_conv.is_owned = false;
60499         LDKNodeId node_id_conv;
60500         node_id_conv.inner = untag_ptr(node_id);
60501         node_id_conv.is_owned = ptr_is_owned(node_id);
60502         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
60503         node_id_conv.is_owned = false;
60504         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
60505 }
60506
60507 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) {
60508         LDKProbabilisticScoringFeeParameters this_arg_conv;
60509         this_arg_conv.inner = untag_ptr(this_arg);
60510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60512         this_arg_conv.is_owned = false;
60513         LDKNodeId node_id_conv;
60514         node_id_conv.inner = untag_ptr(node_id);
60515         node_id_conv.is_owned = ptr_is_owned(node_id);
60516         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
60517         node_id_conv.is_owned = false;
60518         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
60519 }
60520
60521 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
60522         LDKProbabilisticScoringFeeParameters this_arg_conv;
60523         this_arg_conv.inner = untag_ptr(this_arg);
60524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60526         this_arg_conv.is_owned = false;
60527         LDKNodeId node_id_conv;
60528         node_id_conv.inner = untag_ptr(node_id);
60529         node_id_conv.is_owned = ptr_is_owned(node_id);
60530         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
60531         node_id_conv.is_owned = false;
60532         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
60533 }
60534
60535 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
60536         LDKProbabilisticScoringFeeParameters this_arg_conv;
60537         this_arg_conv.inner = untag_ptr(this_arg);
60538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60540         this_arg_conv.is_owned = false;
60541         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
60542 }
60543
60544 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
60545         LDKProbabilisticScoringDecayParameters this_obj_conv;
60546         this_obj_conv.inner = untag_ptr(this_obj);
60547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60549         ProbabilisticScoringDecayParameters_free(this_obj_conv);
60550 }
60551
60552 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) {
60553         LDKProbabilisticScoringDecayParameters this_ptr_conv;
60554         this_ptr_conv.inner = untag_ptr(this_ptr);
60555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60557         this_ptr_conv.is_owned = false;
60558         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
60559         return ret_conv;
60560 }
60561
60562 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) {
60563         LDKProbabilisticScoringDecayParameters 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         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
60569 }
60570
60571 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
60572         LDKProbabilisticScoringDecayParameters this_ptr_conv;
60573         this_ptr_conv.inner = untag_ptr(this_ptr);
60574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60576         this_ptr_conv.is_owned = false;
60577         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
60578         return ret_conv;
60579 }
60580
60581 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) {
60582         LDKProbabilisticScoringDecayParameters this_ptr_conv;
60583         this_ptr_conv.inner = untag_ptr(this_ptr);
60584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60586         this_ptr_conv.is_owned = false;
60587         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
60588 }
60589
60590 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) {
60591         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
60592         uint64_t ret_ref = 0;
60593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60595         return ret_ref;
60596 }
60597
60598 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
60599         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
60600         uint64_t ret_ref = 0;
60601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60603         return ret_ref;
60604 }
60605 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
60606         LDKProbabilisticScoringDecayParameters arg_conv;
60607         arg_conv.inner = untag_ptr(arg);
60608         arg_conv.is_owned = ptr_is_owned(arg);
60609         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60610         arg_conv.is_owned = false;
60611         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
60612         return ret_conv;
60613 }
60614
60615 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
60616         LDKProbabilisticScoringDecayParameters orig_conv;
60617         orig_conv.inner = untag_ptr(orig);
60618         orig_conv.is_owned = ptr_is_owned(orig);
60619         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60620         orig_conv.is_owned = false;
60621         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
60622         uint64_t ret_ref = 0;
60623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60625         return ret_ref;
60626 }
60627
60628 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
60629         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
60630         uint64_t ret_ref = 0;
60631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60633         return ret_ref;
60634 }
60635
60636 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
60637         LDKProbabilisticScoringDecayParameters decay_params_conv;
60638         decay_params_conv.inner = untag_ptr(decay_params);
60639         decay_params_conv.is_owned = ptr_is_owned(decay_params);
60640         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
60641         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
60642         LDKNetworkGraph network_graph_conv;
60643         network_graph_conv.inner = untag_ptr(network_graph);
60644         network_graph_conv.is_owned = ptr_is_owned(network_graph);
60645         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
60646         network_graph_conv.is_owned = false;
60647         void* logger_ptr = untag_ptr(logger);
60648         CHECK_ACCESS(logger_ptr);
60649         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
60650         if (logger_conv.free == LDKLogger_JCalls_free) {
60651                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60652                 LDKLogger_JCalls_cloned(&logger_conv);
60653         }
60654         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
60655         uint64_t ret_ref = 0;
60656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60658         return ret_ref;
60659 }
60660
60661 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
60662         LDKProbabilisticScorer this_arg_conv;
60663         this_arg_conv.inner = untag_ptr(this_arg);
60664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60666         this_arg_conv.is_owned = false;
60667         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
60668 }
60669
60670 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) {
60671         LDKProbabilisticScorer this_arg_conv;
60672         this_arg_conv.inner = untag_ptr(this_arg);
60673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60675         this_arg_conv.is_owned = false;
60676         LDKNodeId target_conv;
60677         target_conv.inner = untag_ptr(target);
60678         target_conv.is_owned = ptr_is_owned(target);
60679         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
60680         target_conv.is_owned = false;
60681         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
60682         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
60683         uint64_t ret_ref = tag_ptr(ret_copy, true);
60684         return ret_ref;
60685 }
60686
60687 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) {
60688         LDKProbabilisticScorer 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         LDKNodeId target_conv;
60694         target_conv.inner = untag_ptr(target);
60695         target_conv.is_owned = ptr_is_owned(target);
60696         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
60697         target_conv.is_owned = false;
60698         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
60699         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
60700         uint64_t ret_ref = tag_ptr(ret_copy, true);
60701         return ret_ref;
60702 }
60703
60704 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_historical_estimated_payment_success_probability"))) TS_ProbabilisticScorer_historical_estimated_payment_success_probability(uint64_t this_arg, int64_t scid, uint64_t target, int64_t amount_msat, uint64_t params) {
60705         LDKProbabilisticScorer this_arg_conv;
60706         this_arg_conv.inner = untag_ptr(this_arg);
60707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60709         this_arg_conv.is_owned = false;
60710         LDKNodeId target_conv;
60711         target_conv.inner = untag_ptr(target);
60712         target_conv.is_owned = ptr_is_owned(target);
60713         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
60714         target_conv.is_owned = false;
60715         LDKProbabilisticScoringFeeParameters params_conv;
60716         params_conv.inner = untag_ptr(params);
60717         params_conv.is_owned = ptr_is_owned(params);
60718         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
60719         params_conv.is_owned = false;
60720         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
60721         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
60722         uint64_t ret_ref = tag_ptr(ret_copy, true);
60723         return ret_ref;
60724 }
60725
60726 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
60727         LDKProbabilisticScorer this_arg_conv;
60728         this_arg_conv.inner = untag_ptr(this_arg);
60729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60731         this_arg_conv.is_owned = false;
60732         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
60733         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
60734         return tag_ptr(ret_ret, true);
60735 }
60736
60737 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
60738         LDKProbabilisticScorer this_arg_conv;
60739         this_arg_conv.inner = untag_ptr(this_arg);
60740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60742         this_arg_conv.is_owned = false;
60743         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60744         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
60745         return tag_ptr(ret_ret, true);
60746 }
60747
60748 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
60749         LDKProbabilisticScorer this_arg_conv;
60750         this_arg_conv.inner = untag_ptr(this_arg);
60751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60753         this_arg_conv.is_owned = false;
60754         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
60755         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
60756         return tag_ptr(ret_ret, true);
60757 }
60758
60759 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
60760         LDKProbabilisticScorer obj_conv;
60761         obj_conv.inner = untag_ptr(obj);
60762         obj_conv.is_owned = ptr_is_owned(obj);
60763         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60764         obj_conv.is_owned = false;
60765         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
60766         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60767         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60768         CVec_u8Z_free(ret_var);
60769         return ret_arr;
60770 }
60771
60772 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) {
60773         LDKu8slice ser_ref;
60774         ser_ref.datalen = ser->arr_len;
60775         ser_ref.data = ser->elems;
60776         LDKProbabilisticScoringDecayParameters arg_a_conv;
60777         arg_a_conv.inner = untag_ptr(arg_a);
60778         arg_a_conv.is_owned = ptr_is_owned(arg_a);
60779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
60780         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
60781         LDKNetworkGraph arg_b_conv;
60782         arg_b_conv.inner = untag_ptr(arg_b);
60783         arg_b_conv.is_owned = ptr_is_owned(arg_b);
60784         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
60785         arg_b_conv.is_owned = false;
60786         void* arg_c_ptr = untag_ptr(arg_c);
60787         CHECK_ACCESS(arg_c_ptr);
60788         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
60789         if (arg_c_conv.free == LDKLogger_JCalls_free) {
60790                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60791                 LDKLogger_JCalls_cloned(&arg_c_conv);
60792         }
60793         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
60794         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
60795         FREE(ser);
60796         return tag_ptr(ret_conv, true);
60797 }
60798
60799 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
60800         LDKDelayedPaymentOutputDescriptor this_obj_conv;
60801         this_obj_conv.inner = untag_ptr(this_obj);
60802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60804         DelayedPaymentOutputDescriptor_free(this_obj_conv);
60805 }
60806
60807 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
60808         LDKDelayedPaymentOutputDescriptor 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         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
60814         uint64_t ret_ref = 0;
60815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60817         return ret_ref;
60818 }
60819
60820 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
60821         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60822         this_ptr_conv.inner = untag_ptr(this_ptr);
60823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60825         this_ptr_conv.is_owned = false;
60826         LDKOutPoint val_conv;
60827         val_conv.inner = untag_ptr(val);
60828         val_conv.is_owned = ptr_is_owned(val);
60829         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60830         val_conv = OutPoint_clone(&val_conv);
60831         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
60832 }
60833
60834 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
60835         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60836         this_ptr_conv.inner = untag_ptr(this_ptr);
60837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60839         this_ptr_conv.is_owned = false;
60840         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60841         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
60842         return ret_arr;
60843 }
60844
60845 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
60846         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60847         this_ptr_conv.inner = untag_ptr(this_ptr);
60848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60850         this_ptr_conv.is_owned = false;
60851         LDKPublicKey val_ref;
60852         CHECK(val->arr_len == 33);
60853         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
60854         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
60855 }
60856
60857 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
60858         LDKDelayedPaymentOutputDescriptor 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         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
60864         return ret_conv;
60865 }
60866
60867 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
60868         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60869         this_ptr_conv.inner = untag_ptr(this_ptr);
60870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60872         this_ptr_conv.is_owned = false;
60873         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
60874 }
60875
60876 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
60877         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60878         this_ptr_conv.inner = untag_ptr(this_ptr);
60879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60881         this_ptr_conv.is_owned = false;
60882         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
60883         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
60884         return tag_ptr(ret_ref, true);
60885 }
60886
60887 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
60888         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60889         this_ptr_conv.inner = untag_ptr(this_ptr);
60890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60892         this_ptr_conv.is_owned = false;
60893         void* val_ptr = untag_ptr(val);
60894         CHECK_ACCESS(val_ptr);
60895         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
60896         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
60897         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
60898 }
60899
60900 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
60901         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60902         this_ptr_conv.inner = untag_ptr(this_ptr);
60903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60905         this_ptr_conv.is_owned = false;
60906         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60907         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
60908         return ret_arr;
60909 }
60910
60911 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
60912         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60913         this_ptr_conv.inner = untag_ptr(this_ptr);
60914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60916         this_ptr_conv.is_owned = false;
60917         LDKPublicKey val_ref;
60918         CHECK(val->arr_len == 33);
60919         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
60920         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
60921 }
60922
60923 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
60924         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60925         this_ptr_conv.inner = untag_ptr(this_ptr);
60926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60928         this_ptr_conv.is_owned = false;
60929         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60930         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
60931         return ret_arr;
60932 }
60933
60934 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
60935         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60936         this_ptr_conv.inner = untag_ptr(this_ptr);
60937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60939         this_ptr_conv.is_owned = false;
60940         LDKThirtyTwoBytes val_ref;
60941         CHECK(val->arr_len == 32);
60942         memcpy(val_ref.data, val->elems, 32); FREE(val);
60943         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
60944 }
60945
60946 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
60947         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60948         this_ptr_conv.inner = untag_ptr(this_ptr);
60949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60951         this_ptr_conv.is_owned = false;
60952         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
60953         return ret_conv;
60954 }
60955
60956 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
60957         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60958         this_ptr_conv.inner = untag_ptr(this_ptr);
60959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60961         this_ptr_conv.is_owned = false;
60962         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
60963 }
60964
60965 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) {
60966         LDKOutPoint outpoint_arg_conv;
60967         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
60968         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
60969         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
60970         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
60971         LDKPublicKey per_commitment_point_arg_ref;
60972         CHECK(per_commitment_point_arg->arr_len == 33);
60973         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
60974         void* output_arg_ptr = untag_ptr(output_arg);
60975         CHECK_ACCESS(output_arg_ptr);
60976         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
60977         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
60978         LDKPublicKey revocation_pubkey_arg_ref;
60979         CHECK(revocation_pubkey_arg->arr_len == 33);
60980         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
60981         LDKThirtyTwoBytes channel_keys_id_arg_ref;
60982         CHECK(channel_keys_id_arg->arr_len == 32);
60983         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
60984         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);
60985         uint64_t ret_ref = 0;
60986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60988         return ret_ref;
60989 }
60990
60991 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
60992         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
60993         uint64_t ret_ref = 0;
60994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60996         return ret_ref;
60997 }
60998 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
60999         LDKDelayedPaymentOutputDescriptor arg_conv;
61000         arg_conv.inner = untag_ptr(arg);
61001         arg_conv.is_owned = ptr_is_owned(arg);
61002         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61003         arg_conv.is_owned = false;
61004         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
61005         return ret_conv;
61006 }
61007
61008 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
61009         LDKDelayedPaymentOutputDescriptor orig_conv;
61010         orig_conv.inner = untag_ptr(orig);
61011         orig_conv.is_owned = ptr_is_owned(orig);
61012         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61013         orig_conv.is_owned = false;
61014         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
61015         uint64_t ret_ref = 0;
61016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61018         return ret_ref;
61019 }
61020
61021 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
61022         LDKDelayedPaymentOutputDescriptor o_conv;
61023         o_conv.inner = untag_ptr(o);
61024         o_conv.is_owned = ptr_is_owned(o);
61025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61026         o_conv.is_owned = false;
61027         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
61028         return ret_conv;
61029 }
61030
61031 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
61032         LDKDelayedPaymentOutputDescriptor a_conv;
61033         a_conv.inner = untag_ptr(a);
61034         a_conv.is_owned = ptr_is_owned(a);
61035         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61036         a_conv.is_owned = false;
61037         LDKDelayedPaymentOutputDescriptor b_conv;
61038         b_conv.inner = untag_ptr(b);
61039         b_conv.is_owned = ptr_is_owned(b);
61040         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61041         b_conv.is_owned = false;
61042         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
61043         return ret_conv;
61044 }
61045
61046 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
61047         LDKDelayedPaymentOutputDescriptor obj_conv;
61048         obj_conv.inner = untag_ptr(obj);
61049         obj_conv.is_owned = ptr_is_owned(obj);
61050         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61051         obj_conv.is_owned = false;
61052         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
61053         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61054         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61055         CVec_u8Z_free(ret_var);
61056         return ret_arr;
61057 }
61058
61059 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
61060         LDKu8slice ser_ref;
61061         ser_ref.datalen = ser->arr_len;
61062         ser_ref.data = ser->elems;
61063         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
61064         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
61065         FREE(ser);
61066         return tag_ptr(ret_conv, true);
61067 }
61068
61069 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
61070         LDKStaticPaymentOutputDescriptor this_obj_conv;
61071         this_obj_conv.inner = untag_ptr(this_obj);
61072         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61074         StaticPaymentOutputDescriptor_free(this_obj_conv);
61075 }
61076
61077 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
61078         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61079         this_ptr_conv.inner = untag_ptr(this_ptr);
61080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61082         this_ptr_conv.is_owned = false;
61083         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
61084         uint64_t ret_ref = 0;
61085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61087         return ret_ref;
61088 }
61089
61090 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
61091         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61092         this_ptr_conv.inner = untag_ptr(this_ptr);
61093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61095         this_ptr_conv.is_owned = false;
61096         LDKOutPoint val_conv;
61097         val_conv.inner = untag_ptr(val);
61098         val_conv.is_owned = ptr_is_owned(val);
61099         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61100         val_conv = OutPoint_clone(&val_conv);
61101         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
61102 }
61103
61104 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
61105         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61106         this_ptr_conv.inner = untag_ptr(this_ptr);
61107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61109         this_ptr_conv.is_owned = false;
61110         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61111         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
61112         return tag_ptr(ret_ref, true);
61113 }
61114
61115 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
61116         LDKStaticPaymentOutputDescriptor 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         void* val_ptr = untag_ptr(val);
61122         CHECK_ACCESS(val_ptr);
61123         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61124         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61125         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
61126 }
61127
61128 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
61129         LDKStaticPaymentOutputDescriptor 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61135         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
61136         return ret_arr;
61137 }
61138
61139 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
61140         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61141         this_ptr_conv.inner = untag_ptr(this_ptr);
61142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61144         this_ptr_conv.is_owned = false;
61145         LDKThirtyTwoBytes val_ref;
61146         CHECK(val->arr_len == 32);
61147         memcpy(val_ref.data, val->elems, 32); FREE(val);
61148         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
61149 }
61150
61151 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
61152         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61153         this_ptr_conv.inner = untag_ptr(this_ptr);
61154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61156         this_ptr_conv.is_owned = false;
61157         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
61158         return ret_conv;
61159 }
61160
61161 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
61162         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61163         this_ptr_conv.inner = untag_ptr(this_ptr);
61164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61166         this_ptr_conv.is_owned = false;
61167         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
61168 }
61169
61170 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
61171         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61172         this_ptr_conv.inner = untag_ptr(this_ptr);
61173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61175         this_ptr_conv.is_owned = false;
61176         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
61177         uint64_t ret_ref = 0;
61178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61180         return ret_ref;
61181 }
61182
61183 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
61184         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61185         this_ptr_conv.inner = untag_ptr(this_ptr);
61186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61188         this_ptr_conv.is_owned = false;
61189         LDKChannelTransactionParameters val_conv;
61190         val_conv.inner = untag_ptr(val);
61191         val_conv.is_owned = ptr_is_owned(val);
61192         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61193         val_conv = ChannelTransactionParameters_clone(&val_conv);
61194         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
61195 }
61196
61197 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_new"))) TS_StaticPaymentOutputDescriptor_new(uint64_t outpoint_arg, uint64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg, uint64_t channel_transaction_parameters_arg) {
61198         LDKOutPoint outpoint_arg_conv;
61199         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61200         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61201         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61202         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61203         void* output_arg_ptr = untag_ptr(output_arg);
61204         CHECK_ACCESS(output_arg_ptr);
61205         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
61206         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
61207         LDKThirtyTwoBytes channel_keys_id_arg_ref;
61208         CHECK(channel_keys_id_arg->arr_len == 32);
61209         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
61210         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
61211         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
61212         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
61213         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
61214         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
61215         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
61216         uint64_t ret_ref = 0;
61217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61219         return ret_ref;
61220 }
61221
61222 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
61223         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
61224         uint64_t ret_ref = 0;
61225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61227         return ret_ref;
61228 }
61229 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
61230         LDKStaticPaymentOutputDescriptor arg_conv;
61231         arg_conv.inner = untag_ptr(arg);
61232         arg_conv.is_owned = ptr_is_owned(arg);
61233         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61234         arg_conv.is_owned = false;
61235         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
61236         return ret_conv;
61237 }
61238
61239 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
61240         LDKStaticPaymentOutputDescriptor orig_conv;
61241         orig_conv.inner = untag_ptr(orig);
61242         orig_conv.is_owned = ptr_is_owned(orig);
61243         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61244         orig_conv.is_owned = false;
61245         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
61246         uint64_t ret_ref = 0;
61247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61249         return ret_ref;
61250 }
61251
61252 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
61253         LDKStaticPaymentOutputDescriptor o_conv;
61254         o_conv.inner = untag_ptr(o);
61255         o_conv.is_owned = ptr_is_owned(o);
61256         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61257         o_conv.is_owned = false;
61258         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
61259         return ret_conv;
61260 }
61261
61262 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
61263         LDKStaticPaymentOutputDescriptor a_conv;
61264         a_conv.inner = untag_ptr(a);
61265         a_conv.is_owned = ptr_is_owned(a);
61266         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61267         a_conv.is_owned = false;
61268         LDKStaticPaymentOutputDescriptor b_conv;
61269         b_conv.inner = untag_ptr(b);
61270         b_conv.is_owned = ptr_is_owned(b);
61271         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61272         b_conv.is_owned = false;
61273         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
61274         return ret_conv;
61275 }
61276
61277 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
61278         LDKStaticPaymentOutputDescriptor this_arg_conv;
61279         this_arg_conv.inner = untag_ptr(this_arg);
61280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61282         this_arg_conv.is_owned = false;
61283         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
61284         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
61285         uint64_t ret_ref = tag_ptr(ret_copy, true);
61286         return ret_ref;
61287 }
61288
61289 uint32_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
61290         LDKStaticPaymentOutputDescriptor this_arg_conv;
61291         this_arg_conv.inner = untag_ptr(this_arg);
61292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61294         this_arg_conv.is_owned = false;
61295         uint32_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
61296         return ret_conv;
61297 }
61298
61299 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
61300         LDKStaticPaymentOutputDescriptor obj_conv;
61301         obj_conv.inner = untag_ptr(obj);
61302         obj_conv.is_owned = ptr_is_owned(obj);
61303         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61304         obj_conv.is_owned = false;
61305         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
61306         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61307         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61308         CVec_u8Z_free(ret_var);
61309         return ret_arr;
61310 }
61311
61312 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
61313         LDKu8slice ser_ref;
61314         ser_ref.datalen = ser->arr_len;
61315         ser_ref.data = ser->elems;
61316         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
61317         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
61318         FREE(ser);
61319         return tag_ptr(ret_conv, true);
61320 }
61321
61322 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
61323         if (!ptr_is_owned(this_ptr)) return;
61324         void* this_ptr_ptr = untag_ptr(this_ptr);
61325         CHECK_ACCESS(this_ptr_ptr);
61326         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
61327         FREE(untag_ptr(this_ptr));
61328         SpendableOutputDescriptor_free(this_ptr_conv);
61329 }
61330
61331 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
61332         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61333         *ret_copy = SpendableOutputDescriptor_clone(arg);
61334         uint64_t ret_ref = tag_ptr(ret_copy, true);
61335         return ret_ref;
61336 }
61337 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
61338         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
61339         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
61340         return ret_conv;
61341 }
61342
61343 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
61344         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
61345         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61346         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
61347         uint64_t ret_ref = tag_ptr(ret_copy, true);
61348         return ret_ref;
61349 }
61350
61351 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
61352         LDKOutPoint outpoint_conv;
61353         outpoint_conv.inner = untag_ptr(outpoint);
61354         outpoint_conv.is_owned = ptr_is_owned(outpoint);
61355         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
61356         outpoint_conv = OutPoint_clone(&outpoint_conv);
61357         void* output_ptr = untag_ptr(output);
61358         CHECK_ACCESS(output_ptr);
61359         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
61360         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
61361         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61362         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
61363         uint64_t ret_ref = tag_ptr(ret_copy, true);
61364         return ret_ref;
61365 }
61366
61367 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
61368         LDKDelayedPaymentOutputDescriptor a_conv;
61369         a_conv.inner = untag_ptr(a);
61370         a_conv.is_owned = ptr_is_owned(a);
61371         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61372         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
61373         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61374         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
61375         uint64_t ret_ref = tag_ptr(ret_copy, true);
61376         return ret_ref;
61377 }
61378
61379 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
61380         LDKStaticPaymentOutputDescriptor a_conv;
61381         a_conv.inner = untag_ptr(a);
61382         a_conv.is_owned = ptr_is_owned(a);
61383         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61384         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
61385         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61386         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
61387         uint64_t ret_ref = tag_ptr(ret_copy, true);
61388         return ret_ref;
61389 }
61390
61391 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
61392         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
61393         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
61394         return ret_conv;
61395 }
61396
61397 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
61398         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
61399         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
61400         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
61401         return ret_conv;
61402 }
61403
61404 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
61405         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
61406         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
61407         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61408         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61409         CVec_u8Z_free(ret_var);
61410         return ret_arr;
61411 }
61412
61413 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
61414         LDKu8slice ser_ref;
61415         ser_ref.datalen = ser->arr_len;
61416         ser_ref.data = ser->elems;
61417         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
61418         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
61419         FREE(ser);
61420         return tag_ptr(ret_conv, true);
61421 }
61422
61423 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) {
61424         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
61425         descriptors_constr.datalen = descriptors->arr_len;
61426         if (descriptors_constr.datalen > 0)
61427                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
61428         else
61429                 descriptors_constr.data = NULL;
61430         uint64_t* descriptors_vals = descriptors->elems;
61431         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
61432                 uint64_t descriptors_conv_27 = descriptors_vals[b];
61433                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
61434                 CHECK_ACCESS(descriptors_conv_27_ptr);
61435                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
61436                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
61437                 descriptors_constr.data[b] = descriptors_conv_27_conv;
61438         }
61439         FREE(descriptors);
61440         LDKCVec_TxOutZ outputs_constr;
61441         outputs_constr.datalen = outputs->arr_len;
61442         if (outputs_constr.datalen > 0)
61443                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
61444         else
61445                 outputs_constr.data = NULL;
61446         uint64_t* outputs_vals = outputs->elems;
61447         for (size_t h = 0; h < outputs_constr.datalen; h++) {
61448                 uint64_t outputs_conv_7 = outputs_vals[h];
61449                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
61450                 CHECK_ACCESS(outputs_conv_7_ptr);
61451                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
61452                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
61453                 outputs_constr.data[h] = outputs_conv_7_conv;
61454         }
61455         FREE(outputs);
61456         LDKCVec_u8Z change_destination_script_ref;
61457         change_destination_script_ref.datalen = change_destination_script->arr_len;
61458         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
61459         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
61460         void* locktime_ptr = untag_ptr(locktime);
61461         CHECK_ACCESS(locktime_ptr);
61462         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
61463         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
61464         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
61465         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
61466         return tag_ptr(ret_conv, true);
61467 }
61468
61469 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
61470         if (!ptr_is_owned(this_ptr)) return;
61471         void* this_ptr_ptr = untag_ptr(this_ptr);
61472         CHECK_ACCESS(this_ptr_ptr);
61473         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
61474         FREE(untag_ptr(this_ptr));
61475         ChannelSigner_free(this_ptr_conv);
61476 }
61477
61478 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
61479         if (!ptr_is_owned(this_ptr)) return;
61480         void* this_ptr_ptr = untag_ptr(this_ptr);
61481         CHECK_ACCESS(this_ptr_ptr);
61482         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
61483         FREE(untag_ptr(this_ptr));
61484         EcdsaChannelSigner_free(this_ptr_conv);
61485 }
61486
61487 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
61488         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
61489         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
61490         return tag_ptr(ret_ret, true);
61491 }
61492 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
61493         void* arg_ptr = untag_ptr(arg);
61494         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
61495         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
61496         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
61497         return ret_conv;
61498 }
61499
61500 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
61501         void* orig_ptr = untag_ptr(orig);
61502         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
61503         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
61504         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
61505         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
61506         return tag_ptr(ret_ret, true);
61507 }
61508
61509 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
61510         if (!ptr_is_owned(this_ptr)) return;
61511         void* this_ptr_ptr = untag_ptr(this_ptr);
61512         CHECK_ACCESS(this_ptr_ptr);
61513         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
61514         FREE(untag_ptr(this_ptr));
61515         WriteableEcdsaChannelSigner_free(this_ptr_conv);
61516 }
61517
61518 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
61519         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
61520         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
61521         return ret_conv;
61522 }
61523
61524 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
61525         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
61526         return ret_conv;
61527 }
61528
61529 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
61530         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
61531         return ret_conv;
61532 }
61533
61534 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
61535         if (!ptr_is_owned(this_ptr)) return;
61536         void* this_ptr_ptr = untag_ptr(this_ptr);
61537         CHECK_ACCESS(this_ptr_ptr);
61538         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
61539         FREE(untag_ptr(this_ptr));
61540         EntropySource_free(this_ptr_conv);
61541 }
61542
61543 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
61544         if (!ptr_is_owned(this_ptr)) return;
61545         void* this_ptr_ptr = untag_ptr(this_ptr);
61546         CHECK_ACCESS(this_ptr_ptr);
61547         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
61548         FREE(untag_ptr(this_ptr));
61549         NodeSigner_free(this_ptr_conv);
61550 }
61551
61552 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
61553         if (!ptr_is_owned(this_ptr)) return;
61554         void* this_ptr_ptr = untag_ptr(this_ptr);
61555         CHECK_ACCESS(this_ptr_ptr);
61556         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
61557         FREE(untag_ptr(this_ptr));
61558         SignerProvider_free(this_ptr_conv);
61559 }
61560
61561 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
61562         LDKInMemorySigner this_obj_conv;
61563         this_obj_conv.inner = untag_ptr(this_obj);
61564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61566         InMemorySigner_free(this_obj_conv);
61567 }
61568
61569 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
61570         LDKInMemorySigner this_ptr_conv;
61571         this_ptr_conv.inner = untag_ptr(this_ptr);
61572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61574         this_ptr_conv.is_owned = false;
61575         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61576         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
61577         return ret_arr;
61578 }
61579
61580 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
61581         LDKInMemorySigner this_ptr_conv;
61582         this_ptr_conv.inner = untag_ptr(this_ptr);
61583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61585         this_ptr_conv.is_owned = false;
61586         LDKSecretKey val_ref;
61587         CHECK(val->arr_len == 32);
61588         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61589         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
61590 }
61591
61592 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
61593         LDKInMemorySigner this_ptr_conv;
61594         this_ptr_conv.inner = untag_ptr(this_ptr);
61595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61597         this_ptr_conv.is_owned = false;
61598         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61599         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
61600         return ret_arr;
61601 }
61602
61603 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
61604         LDKInMemorySigner this_ptr_conv;
61605         this_ptr_conv.inner = untag_ptr(this_ptr);
61606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61608         this_ptr_conv.is_owned = false;
61609         LDKSecretKey val_ref;
61610         CHECK(val->arr_len == 32);
61611         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61612         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
61613 }
61614
61615 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
61616         LDKInMemorySigner this_ptr_conv;
61617         this_ptr_conv.inner = untag_ptr(this_ptr);
61618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61620         this_ptr_conv.is_owned = false;
61621         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61622         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
61623         return ret_arr;
61624 }
61625
61626 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
61627         LDKInMemorySigner this_ptr_conv;
61628         this_ptr_conv.inner = untag_ptr(this_ptr);
61629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61631         this_ptr_conv.is_owned = false;
61632         LDKSecretKey val_ref;
61633         CHECK(val->arr_len == 32);
61634         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61635         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
61636 }
61637
61638 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
61639         LDKInMemorySigner this_ptr_conv;
61640         this_ptr_conv.inner = untag_ptr(this_ptr);
61641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61643         this_ptr_conv.is_owned = false;
61644         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61645         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
61646         return ret_arr;
61647 }
61648
61649 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) {
61650         LDKInMemorySigner this_ptr_conv;
61651         this_ptr_conv.inner = untag_ptr(this_ptr);
61652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61654         this_ptr_conv.is_owned = false;
61655         LDKSecretKey val_ref;
61656         CHECK(val->arr_len == 32);
61657         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61658         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
61659 }
61660
61661 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
61662         LDKInMemorySigner this_ptr_conv;
61663         this_ptr_conv.inner = untag_ptr(this_ptr);
61664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61666         this_ptr_conv.is_owned = false;
61667         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61668         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
61669         return ret_arr;
61670 }
61671
61672 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
61673         LDKInMemorySigner this_ptr_conv;
61674         this_ptr_conv.inner = untag_ptr(this_ptr);
61675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61677         this_ptr_conv.is_owned = false;
61678         LDKSecretKey val_ref;
61679         CHECK(val->arr_len == 32);
61680         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61681         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
61682 }
61683
61684 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
61685         LDKInMemorySigner this_ptr_conv;
61686         this_ptr_conv.inner = untag_ptr(this_ptr);
61687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61689         this_ptr_conv.is_owned = false;
61690         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61691         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
61692         return ret_arr;
61693 }
61694
61695 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
61696         LDKInMemorySigner this_ptr_conv;
61697         this_ptr_conv.inner = untag_ptr(this_ptr);
61698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61700         this_ptr_conv.is_owned = false;
61701         LDKThirtyTwoBytes val_ref;
61702         CHECK(val->arr_len == 32);
61703         memcpy(val_ref.data, val->elems, 32); FREE(val);
61704         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
61705 }
61706
61707 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
61708         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
61709         uint64_t ret_ref = 0;
61710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61712         return ret_ref;
61713 }
61714 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
61715         LDKInMemorySigner arg_conv;
61716         arg_conv.inner = untag_ptr(arg);
61717         arg_conv.is_owned = ptr_is_owned(arg);
61718         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61719         arg_conv.is_owned = false;
61720         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
61721         return ret_conv;
61722 }
61723
61724 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
61725         LDKInMemorySigner orig_conv;
61726         orig_conv.inner = untag_ptr(orig);
61727         orig_conv.is_owned = ptr_is_owned(orig);
61728         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61729         orig_conv.is_owned = false;
61730         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
61731         uint64_t ret_ref = 0;
61732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61734         return ret_ref;
61735 }
61736
61737 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) {
61738         LDKSecretKey funding_key_ref;
61739         CHECK(funding_key->arr_len == 32);
61740         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
61741         LDKSecretKey revocation_base_key_ref;
61742         CHECK(revocation_base_key->arr_len == 32);
61743         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
61744         LDKSecretKey payment_key_ref;
61745         CHECK(payment_key->arr_len == 32);
61746         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
61747         LDKSecretKey delayed_payment_base_key_ref;
61748         CHECK(delayed_payment_base_key->arr_len == 32);
61749         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
61750         LDKSecretKey htlc_base_key_ref;
61751         CHECK(htlc_base_key->arr_len == 32);
61752         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
61753         LDKThirtyTwoBytes commitment_seed_ref;
61754         CHECK(commitment_seed->arr_len == 32);
61755         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
61756         LDKThirtyTwoBytes channel_keys_id_ref;
61757         CHECK(channel_keys_id->arr_len == 32);
61758         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
61759         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
61760         CHECK(rand_bytes_unique_start->arr_len == 32);
61761         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
61762         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);
61763         uint64_t ret_ref = 0;
61764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61766         return ret_ref;
61767 }
61768
61769 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
61770         LDKInMemorySigner this_arg_conv;
61771         this_arg_conv.inner = untag_ptr(this_arg);
61772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61774         this_arg_conv.is_owned = false;
61775         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
61776         uint64_t ret_ref = 0;
61777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61779         return ret_ref;
61780 }
61781
61782 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
61783         LDKInMemorySigner this_arg_conv;
61784         this_arg_conv.inner = untag_ptr(this_arg);
61785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61787         this_arg_conv.is_owned = false;
61788         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
61789         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
61790         uint64_t ret_ref = tag_ptr(ret_copy, true);
61791         return ret_ref;
61792 }
61793
61794 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
61795         LDKInMemorySigner this_arg_conv;
61796         this_arg_conv.inner = untag_ptr(this_arg);
61797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61799         this_arg_conv.is_owned = false;
61800         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
61801         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
61802         uint64_t ret_ref = tag_ptr(ret_copy, true);
61803         return ret_ref;
61804 }
61805
61806 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
61807         LDKInMemorySigner this_arg_conv;
61808         this_arg_conv.inner = untag_ptr(this_arg);
61809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61811         this_arg_conv.is_owned = false;
61812         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
61813         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
61814         uint64_t ret_ref = tag_ptr(ret_copy, true);
61815         return ret_ref;
61816 }
61817
61818 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
61819         LDKInMemorySigner this_arg_conv;
61820         this_arg_conv.inner = untag_ptr(this_arg);
61821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61823         this_arg_conv.is_owned = false;
61824         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
61825         uint64_t ret_ref = 0;
61826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61828         return ret_ref;
61829 }
61830
61831 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
61832         LDKInMemorySigner this_arg_conv;
61833         this_arg_conv.inner = untag_ptr(this_arg);
61834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61836         this_arg_conv.is_owned = false;
61837         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
61838         uint64_t ret_ref = 0;
61839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61841         return ret_ref;
61842 }
61843
61844 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
61845         LDKInMemorySigner this_arg_conv;
61846         this_arg_conv.inner = untag_ptr(this_arg);
61847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61849         this_arg_conv.is_owned = false;
61850         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
61851         uint64_t ret_ref = 0;
61852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61854         return ret_ref;
61855 }
61856
61857 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) {
61858         LDKInMemorySigner this_arg_conv;
61859         this_arg_conv.inner = untag_ptr(this_arg);
61860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61862         this_arg_conv.is_owned = false;
61863         LDKTransaction spend_tx_ref;
61864         spend_tx_ref.datalen = spend_tx->arr_len;
61865         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
61866         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
61867         spend_tx_ref.data_is_owned = true;
61868         LDKStaticPaymentOutputDescriptor descriptor_conv;
61869         descriptor_conv.inner = untag_ptr(descriptor);
61870         descriptor_conv.is_owned = ptr_is_owned(descriptor);
61871         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
61872         descriptor_conv.is_owned = false;
61873         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
61874         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
61875         return tag_ptr(ret_conv, true);
61876 }
61877
61878 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) {
61879         LDKInMemorySigner this_arg_conv;
61880         this_arg_conv.inner = untag_ptr(this_arg);
61881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61883         this_arg_conv.is_owned = false;
61884         LDKTransaction spend_tx_ref;
61885         spend_tx_ref.datalen = spend_tx->arr_len;
61886         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
61887         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
61888         spend_tx_ref.data_is_owned = true;
61889         LDKDelayedPaymentOutputDescriptor descriptor_conv;
61890         descriptor_conv.inner = untag_ptr(descriptor);
61891         descriptor_conv.is_owned = ptr_is_owned(descriptor);
61892         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
61893         descriptor_conv.is_owned = false;
61894         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
61895         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
61896         return tag_ptr(ret_conv, true);
61897 }
61898
61899 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
61900         LDKInMemorySigner this_arg_conv;
61901         this_arg_conv.inner = untag_ptr(this_arg);
61902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61904         this_arg_conv.is_owned = false;
61905         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
61906         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
61907         return tag_ptr(ret_ret, true);
61908 }
61909
61910 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
61911         LDKInMemorySigner this_arg_conv;
61912         this_arg_conv.inner = untag_ptr(this_arg);
61913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61915         this_arg_conv.is_owned = false;
61916         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
61917         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
61918         return tag_ptr(ret_ret, true);
61919 }
61920
61921 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
61922         LDKInMemorySigner this_arg_conv;
61923         this_arg_conv.inner = untag_ptr(this_arg);
61924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61926         this_arg_conv.is_owned = false;
61927         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
61928         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
61929         return tag_ptr(ret_ret, true);
61930 }
61931
61932 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
61933         LDKInMemorySigner this_arg_conv;
61934         this_arg_conv.inner = untag_ptr(this_arg);
61935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61937         this_arg_conv.is_owned = false;
61938         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
61939         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
61940         return tag_ptr(ret_ret, true);
61941 }
61942
61943 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
61944         LDKInMemorySigner obj_conv;
61945         obj_conv.inner = untag_ptr(obj);
61946         obj_conv.is_owned = ptr_is_owned(obj);
61947         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61948         obj_conv.is_owned = false;
61949         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
61950         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61951         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61952         CVec_u8Z_free(ret_var);
61953         return ret_arr;
61954 }
61955
61956 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
61957         LDKu8slice ser_ref;
61958         ser_ref.datalen = ser->arr_len;
61959         ser_ref.data = ser->elems;
61960         void* arg_ptr = untag_ptr(arg);
61961         CHECK_ACCESS(arg_ptr);
61962         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
61963         if (arg_conv.free == LDKEntropySource_JCalls_free) {
61964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61965                 LDKEntropySource_JCalls_cloned(&arg_conv);
61966         }
61967         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
61968         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
61969         FREE(ser);
61970         return tag_ptr(ret_conv, true);
61971 }
61972
61973 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
61974         LDKKeysManager this_obj_conv;
61975         this_obj_conv.inner = untag_ptr(this_obj);
61976         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61978         KeysManager_free(this_obj_conv);
61979 }
61980
61981 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
61982         uint8_t seed_arr[32];
61983         CHECK(seed->arr_len == 32);
61984         memcpy(seed_arr, seed->elems, 32); FREE(seed);
61985         uint8_t (*seed_ref)[32] = &seed_arr;
61986         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
61987         uint64_t ret_ref = 0;
61988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61990         return ret_ref;
61991 }
61992
61993 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
61994         LDKKeysManager this_arg_conv;
61995         this_arg_conv.inner = untag_ptr(this_arg);
61996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61998         this_arg_conv.is_owned = false;
61999         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62000         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
62001         return ret_arr;
62002 }
62003
62004 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) {
62005         LDKKeysManager this_arg_conv;
62006         this_arg_conv.inner = untag_ptr(this_arg);
62007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62009         this_arg_conv.is_owned = false;
62010         uint8_t params_arr[32];
62011         CHECK(params->arr_len == 32);
62012         memcpy(params_arr, params->elems, 32); FREE(params);
62013         uint8_t (*params_ref)[32] = &params_arr;
62014         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
62015         uint64_t ret_ref = 0;
62016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62018         return ret_ref;
62019 }
62020
62021 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) {
62022         LDKKeysManager this_arg_conv;
62023         this_arg_conv.inner = untag_ptr(this_arg);
62024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62026         this_arg_conv.is_owned = false;
62027         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62028         descriptors_constr.datalen = descriptors->arr_len;
62029         if (descriptors_constr.datalen > 0)
62030                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62031         else
62032                 descriptors_constr.data = NULL;
62033         uint64_t* descriptors_vals = descriptors->elems;
62034         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62035                 uint64_t descriptors_conv_27 = descriptors_vals[b];
62036                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62037                 CHECK_ACCESS(descriptors_conv_27_ptr);
62038                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62039                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62040                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62041         }
62042         FREE(descriptors);
62043         LDKCVec_u8Z psbt_ref;
62044         psbt_ref.datalen = psbt->arr_len;
62045         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
62046         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
62047         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
62048         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
62049         return tag_ptr(ret_conv, true);
62050 }
62051
62052 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) {
62053         LDKKeysManager this_arg_conv;
62054         this_arg_conv.inner = untag_ptr(this_arg);
62055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62057         this_arg_conv.is_owned = false;
62058         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62059         descriptors_constr.datalen = descriptors->arr_len;
62060         if (descriptors_constr.datalen > 0)
62061                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62062         else
62063                 descriptors_constr.data = NULL;
62064         uint64_t* descriptors_vals = descriptors->elems;
62065         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62066                 uint64_t descriptors_conv_27 = descriptors_vals[b];
62067                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62068                 CHECK_ACCESS(descriptors_conv_27_ptr);
62069                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62070                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62071                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62072         }
62073         FREE(descriptors);
62074         LDKCVec_TxOutZ outputs_constr;
62075         outputs_constr.datalen = outputs->arr_len;
62076         if (outputs_constr.datalen > 0)
62077                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
62078         else
62079                 outputs_constr.data = NULL;
62080         uint64_t* outputs_vals = outputs->elems;
62081         for (size_t h = 0; h < outputs_constr.datalen; h++) {
62082                 uint64_t outputs_conv_7 = outputs_vals[h];
62083                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
62084                 CHECK_ACCESS(outputs_conv_7_ptr);
62085                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
62086                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
62087                 outputs_constr.data[h] = outputs_conv_7_conv;
62088         }
62089         FREE(outputs);
62090         LDKCVec_u8Z change_destination_script_ref;
62091         change_destination_script_ref.datalen = change_destination_script->arr_len;
62092         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
62093         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
62094         void* locktime_ptr = untag_ptr(locktime);
62095         CHECK_ACCESS(locktime_ptr);
62096         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
62097         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
62098         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
62099         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
62100         return tag_ptr(ret_conv, true);
62101 }
62102
62103 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
62104         LDKKeysManager this_arg_conv;
62105         this_arg_conv.inner = untag_ptr(this_arg);
62106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62108         this_arg_conv.is_owned = false;
62109         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
62110         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
62111         return tag_ptr(ret_ret, true);
62112 }
62113
62114 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
62115         LDKKeysManager this_arg_conv;
62116         this_arg_conv.inner = untag_ptr(this_arg);
62117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62119         this_arg_conv.is_owned = false;
62120         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
62121         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
62122         return tag_ptr(ret_ret, true);
62123 }
62124
62125 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
62126         LDKKeysManager this_arg_conv;
62127         this_arg_conv.inner = untag_ptr(this_arg);
62128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62130         this_arg_conv.is_owned = false;
62131         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
62132         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
62133         return tag_ptr(ret_ret, true);
62134 }
62135
62136 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
62137         LDKPhantomKeysManager this_obj_conv;
62138         this_obj_conv.inner = untag_ptr(this_obj);
62139         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62141         PhantomKeysManager_free(this_obj_conv);
62142 }
62143
62144 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
62145         LDKPhantomKeysManager this_arg_conv;
62146         this_arg_conv.inner = untag_ptr(this_arg);
62147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62149         this_arg_conv.is_owned = false;
62150         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
62151         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
62152         return tag_ptr(ret_ret, true);
62153 }
62154
62155 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
62156         LDKPhantomKeysManager this_arg_conv;
62157         this_arg_conv.inner = untag_ptr(this_arg);
62158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62160         this_arg_conv.is_owned = false;
62161         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
62162         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
62163         return tag_ptr(ret_ret, true);
62164 }
62165
62166 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
62167         LDKPhantomKeysManager this_arg_conv;
62168         this_arg_conv.inner = untag_ptr(this_arg);
62169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62171         this_arg_conv.is_owned = false;
62172         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
62173         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
62174         return tag_ptr(ret_ret, true);
62175 }
62176
62177 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) {
62178         uint8_t seed_arr[32];
62179         CHECK(seed->arr_len == 32);
62180         memcpy(seed_arr, seed->elems, 32); FREE(seed);
62181         uint8_t (*seed_ref)[32] = &seed_arr;
62182         uint8_t cross_node_seed_arr[32];
62183         CHECK(cross_node_seed->arr_len == 32);
62184         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
62185         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
62186         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
62187         uint64_t ret_ref = 0;
62188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62190         return ret_ref;
62191 }
62192
62193 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) {
62194         LDKPhantomKeysManager this_arg_conv;
62195         this_arg_conv.inner = untag_ptr(this_arg);
62196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62198         this_arg_conv.is_owned = false;
62199         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62200         descriptors_constr.datalen = descriptors->arr_len;
62201         if (descriptors_constr.datalen > 0)
62202                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62203         else
62204                 descriptors_constr.data = NULL;
62205         uint64_t* descriptors_vals = descriptors->elems;
62206         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62207                 uint64_t descriptors_conv_27 = descriptors_vals[b];
62208                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62209                 CHECK_ACCESS(descriptors_conv_27_ptr);
62210                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62211                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62212                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62213         }
62214         FREE(descriptors);
62215         LDKCVec_TxOutZ outputs_constr;
62216         outputs_constr.datalen = outputs->arr_len;
62217         if (outputs_constr.datalen > 0)
62218                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
62219         else
62220                 outputs_constr.data = NULL;
62221         uint64_t* outputs_vals = outputs->elems;
62222         for (size_t h = 0; h < outputs_constr.datalen; h++) {
62223                 uint64_t outputs_conv_7 = outputs_vals[h];
62224                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
62225                 CHECK_ACCESS(outputs_conv_7_ptr);
62226                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
62227                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
62228                 outputs_constr.data[h] = outputs_conv_7_conv;
62229         }
62230         FREE(outputs);
62231         LDKCVec_u8Z change_destination_script_ref;
62232         change_destination_script_ref.datalen = change_destination_script->arr_len;
62233         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
62234         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
62235         void* locktime_ptr = untag_ptr(locktime);
62236         CHECK_ACCESS(locktime_ptr);
62237         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
62238         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
62239         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
62240         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
62241         return tag_ptr(ret_conv, true);
62242 }
62243
62244 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) {
62245         LDKPhantomKeysManager this_arg_conv;
62246         this_arg_conv.inner = untag_ptr(this_arg);
62247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62249         this_arg_conv.is_owned = false;
62250         uint8_t params_arr[32];
62251         CHECK(params->arr_len == 32);
62252         memcpy(params_arr, params->elems, 32); FREE(params);
62253         uint8_t (*params_ref)[32] = &params_arr;
62254         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
62255         uint64_t ret_ref = 0;
62256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62258         return ret_ref;
62259 }
62260
62261 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
62262         LDKPhantomKeysManager this_arg_conv;
62263         this_arg_conv.inner = untag_ptr(this_arg);
62264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62266         this_arg_conv.is_owned = false;
62267         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62268         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
62269         return ret_arr;
62270 }
62271
62272 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
62273         LDKPhantomKeysManager this_arg_conv;
62274         this_arg_conv.inner = untag_ptr(this_arg);
62275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62277         this_arg_conv.is_owned = false;
62278         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62279         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
62280         return ret_arr;
62281 }
62282
62283 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
62284         LDKOnionMessenger this_obj_conv;
62285         this_obj_conv.inner = untag_ptr(this_obj);
62286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62288         OnionMessenger_free(this_obj_conv);
62289 }
62290
62291 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
62292         if (!ptr_is_owned(this_ptr)) return;
62293         void* this_ptr_ptr = untag_ptr(this_ptr);
62294         CHECK_ACCESS(this_ptr_ptr);
62295         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
62296         FREE(untag_ptr(this_ptr));
62297         MessageRouter_free(this_ptr_conv);
62298 }
62299
62300 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
62301         LDKDefaultMessageRouter this_obj_conv;
62302         this_obj_conv.inner = untag_ptr(this_obj);
62303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62305         DefaultMessageRouter_free(this_obj_conv);
62306 }
62307
62308 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new() {
62309         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
62310         uint64_t ret_ref = 0;
62311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62313         return ret_ref;
62314 }
62315
62316 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
62317         LDKDefaultMessageRouter this_arg_conv;
62318         this_arg_conv.inner = untag_ptr(this_arg);
62319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62321         this_arg_conv.is_owned = false;
62322         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
62323         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
62324         return tag_ptr(ret_ret, true);
62325 }
62326
62327 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
62328         LDKOnionMessagePath this_obj_conv;
62329         this_obj_conv.inner = untag_ptr(this_obj);
62330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62332         OnionMessagePath_free(this_obj_conv);
62333 }
62334
62335 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
62336         LDKOnionMessagePath this_ptr_conv;
62337         this_ptr_conv.inner = untag_ptr(this_ptr);
62338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62340         this_ptr_conv.is_owned = false;
62341         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
62342         ptrArray ret_arr = NULL;
62343         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
62344         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
62345         for (size_t m = 0; m < ret_var.datalen; m++) {
62346                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
62347                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
62348                 ret_arr_ptr[m] = ret_conv_12_arr;
62349         }
62350         
62351         FREE(ret_var.data);
62352         return ret_arr;
62353 }
62354
62355 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
62356         LDKOnionMessagePath this_ptr_conv;
62357         this_ptr_conv.inner = untag_ptr(this_ptr);
62358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62360         this_ptr_conv.is_owned = false;
62361         LDKCVec_PublicKeyZ val_constr;
62362         val_constr.datalen = val->arr_len;
62363         if (val_constr.datalen > 0)
62364                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
62365         else
62366                 val_constr.data = NULL;
62367         int8_tArray* val_vals = (void*) val->elems;
62368         for (size_t m = 0; m < val_constr.datalen; m++) {
62369                 int8_tArray val_conv_12 = val_vals[m];
62370                 LDKPublicKey val_conv_12_ref;
62371                 CHECK(val_conv_12->arr_len == 33);
62372                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
62373                 val_constr.data[m] = val_conv_12_ref;
62374         }
62375         FREE(val);
62376         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
62377 }
62378
62379 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
62380         LDKOnionMessagePath this_ptr_conv;
62381         this_ptr_conv.inner = untag_ptr(this_ptr);
62382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62384         this_ptr_conv.is_owned = false;
62385         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62386         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
62387         uint64_t ret_ref = tag_ptr(ret_copy, true);
62388         return ret_ref;
62389 }
62390
62391 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
62392         LDKOnionMessagePath this_ptr_conv;
62393         this_ptr_conv.inner = untag_ptr(this_ptr);
62394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62396         this_ptr_conv.is_owned = false;
62397         void* val_ptr = untag_ptr(val);
62398         CHECK_ACCESS(val_ptr);
62399         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
62400         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
62401         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
62402 }
62403
62404 uint64_t  __attribute__((export_name("TS_OnionMessagePath_new"))) TS_OnionMessagePath_new(ptrArray intermediate_nodes_arg, uint64_t destination_arg) {
62405         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
62406         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
62407         if (intermediate_nodes_arg_constr.datalen > 0)
62408                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
62409         else
62410                 intermediate_nodes_arg_constr.data = NULL;
62411         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
62412         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
62413                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
62414                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
62415                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
62416                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
62417                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
62418         }
62419         FREE(intermediate_nodes_arg);
62420         void* destination_arg_ptr = untag_ptr(destination_arg);
62421         CHECK_ACCESS(destination_arg_ptr);
62422         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
62423         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
62424         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
62425         uint64_t ret_ref = 0;
62426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62428         return ret_ref;
62429 }
62430
62431 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
62432         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
62433         uint64_t ret_ref = 0;
62434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62436         return ret_ref;
62437 }
62438 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
62439         LDKOnionMessagePath arg_conv;
62440         arg_conv.inner = untag_ptr(arg);
62441         arg_conv.is_owned = ptr_is_owned(arg);
62442         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62443         arg_conv.is_owned = false;
62444         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
62445         return ret_conv;
62446 }
62447
62448 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
62449         LDKOnionMessagePath orig_conv;
62450         orig_conv.inner = untag_ptr(orig);
62451         orig_conv.is_owned = ptr_is_owned(orig);
62452         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62453         orig_conv.is_owned = false;
62454         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
62455         uint64_t ret_ref = 0;
62456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62458         return ret_ref;
62459 }
62460
62461 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
62462         if (!ptr_is_owned(this_ptr)) return;
62463         void* this_ptr_ptr = untag_ptr(this_ptr);
62464         CHECK_ACCESS(this_ptr_ptr);
62465         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
62466         FREE(untag_ptr(this_ptr));
62467         Destination_free(this_ptr_conv);
62468 }
62469
62470 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
62471         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62472         *ret_copy = Destination_clone(arg);
62473         uint64_t ret_ref = tag_ptr(ret_copy, true);
62474         return ret_ref;
62475 }
62476 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
62477         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
62478         int64_t ret_conv = Destination_clone_ptr(arg_conv);
62479         return ret_conv;
62480 }
62481
62482 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
62483         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
62484         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62485         *ret_copy = Destination_clone(orig_conv);
62486         uint64_t ret_ref = tag_ptr(ret_copy, true);
62487         return ret_ref;
62488 }
62489
62490 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
62491         LDKPublicKey a_ref;
62492         CHECK(a->arr_len == 33);
62493         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
62494         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62495         *ret_copy = Destination_node(a_ref);
62496         uint64_t ret_ref = tag_ptr(ret_copy, true);
62497         return ret_ref;
62498 }
62499
62500 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
62501         LDKBlindedPath a_conv;
62502         a_conv.inner = untag_ptr(a);
62503         a_conv.is_owned = ptr_is_owned(a);
62504         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62505         a_conv = BlindedPath_clone(&a_conv);
62506         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62507         *ret_copy = Destination_blinded_path(a_conv);
62508         uint64_t ret_ref = tag_ptr(ret_copy, true);
62509         return ret_ref;
62510 }
62511
62512 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
62513         if (!ptr_is_owned(this_ptr)) return;
62514         void* this_ptr_ptr = untag_ptr(this_ptr);
62515         CHECK_ACCESS(this_ptr_ptr);
62516         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
62517         FREE(untag_ptr(this_ptr));
62518         SendError_free(this_ptr_conv);
62519 }
62520
62521 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
62522         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62523         *ret_copy = SendError_clone(arg);
62524         uint64_t ret_ref = tag_ptr(ret_copy, true);
62525         return ret_ref;
62526 }
62527 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
62528         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
62529         int64_t ret_conv = SendError_clone_ptr(arg_conv);
62530         return ret_conv;
62531 }
62532
62533 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
62534         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
62535         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62536         *ret_copy = SendError_clone(orig_conv);
62537         uint64_t ret_ref = tag_ptr(ret_copy, true);
62538         return ret_ref;
62539 }
62540
62541 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
62542         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
62543         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62544         *ret_copy = SendError_secp256k1(a_conv);
62545         uint64_t ret_ref = tag_ptr(ret_copy, true);
62546         return ret_ref;
62547 }
62548
62549 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
62550         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62551         *ret_copy = SendError_too_big_packet();
62552         uint64_t ret_ref = tag_ptr(ret_copy, true);
62553         return ret_ref;
62554 }
62555
62556 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
62557         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62558         *ret_copy = SendError_too_few_blinded_hops();
62559         uint64_t ret_ref = tag_ptr(ret_copy, true);
62560         return ret_ref;
62561 }
62562
62563 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
62564         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62565         *ret_copy = SendError_invalid_first_hop();
62566         uint64_t ret_ref = tag_ptr(ret_copy, true);
62567         return ret_ref;
62568 }
62569
62570 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
62571         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62572         *ret_copy = SendError_invalid_message();
62573         uint64_t ret_ref = tag_ptr(ret_copy, true);
62574         return ret_ref;
62575 }
62576
62577 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
62578         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62579         *ret_copy = SendError_buffer_full();
62580         uint64_t ret_ref = tag_ptr(ret_copy, true);
62581         return ret_ref;
62582 }
62583
62584 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
62585         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62586         *ret_copy = SendError_get_node_id_failed();
62587         uint64_t ret_ref = tag_ptr(ret_copy, true);
62588         return ret_ref;
62589 }
62590
62591 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
62592         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62593         *ret_copy = SendError_blinded_path_advance_failed();
62594         uint64_t ret_ref = tag_ptr(ret_copy, true);
62595         return ret_ref;
62596 }
62597
62598 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
62599         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
62600         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
62601         jboolean ret_conv = SendError_eq(a_conv, b_conv);
62602         return ret_conv;
62603 }
62604
62605 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
62606         if (!ptr_is_owned(this_ptr)) return;
62607         void* this_ptr_ptr = untag_ptr(this_ptr);
62608         CHECK_ACCESS(this_ptr_ptr);
62609         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
62610         FREE(untag_ptr(this_ptr));
62611         CustomOnionMessageHandler_free(this_ptr_conv);
62612 }
62613
62614 uint64_t  __attribute__((export_name("TS_create_onion_message"))) TS_create_onion_message(uint64_t entropy_source, uint64_t node_signer, uint64_t path, uint64_t message, uint64_t reply_path) {
62615         void* entropy_source_ptr = untag_ptr(entropy_source);
62616         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
62617         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
62618         void* node_signer_ptr = untag_ptr(node_signer);
62619         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
62620         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
62621         LDKOnionMessagePath path_conv;
62622         path_conv.inner = untag_ptr(path);
62623         path_conv.is_owned = ptr_is_owned(path);
62624         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
62625         path_conv = OnionMessagePath_clone(&path_conv);
62626         void* message_ptr = untag_ptr(message);
62627         CHECK_ACCESS(message_ptr);
62628         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
62629         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
62630         LDKBlindedPath reply_path_conv;
62631         reply_path_conv.inner = untag_ptr(reply_path);
62632         reply_path_conv.is_owned = ptr_is_owned(reply_path);
62633         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
62634         reply_path_conv = BlindedPath_clone(&reply_path_conv);
62635         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
62636         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, message_conv, reply_path_conv);
62637         return tag_ptr(ret_conv, true);
62638 }
62639
62640 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) {
62641         void* entropy_source_ptr = untag_ptr(entropy_source);
62642         CHECK_ACCESS(entropy_source_ptr);
62643         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
62644         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
62645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62646                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
62647         }
62648         void* node_signer_ptr = untag_ptr(node_signer);
62649         CHECK_ACCESS(node_signer_ptr);
62650         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
62651         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
62652                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62653                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
62654         }
62655         void* logger_ptr = untag_ptr(logger);
62656         CHECK_ACCESS(logger_ptr);
62657         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62658         if (logger_conv.free == LDKLogger_JCalls_free) {
62659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62660                 LDKLogger_JCalls_cloned(&logger_conv);
62661         }
62662         void* message_router_ptr = untag_ptr(message_router);
62663         CHECK_ACCESS(message_router_ptr);
62664         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
62665         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
62666                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62667                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
62668         }
62669         void* offers_handler_ptr = untag_ptr(offers_handler);
62670         CHECK_ACCESS(offers_handler_ptr);
62671         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
62672         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
62673                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62674                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
62675         }
62676         void* custom_handler_ptr = untag_ptr(custom_handler);
62677         CHECK_ACCESS(custom_handler_ptr);
62678         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
62679         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
62680                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62681                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
62682         }
62683         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
62684         uint64_t ret_ref = 0;
62685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62687         return ret_ref;
62688 }
62689
62690 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) {
62691         LDKOnionMessenger this_arg_conv;
62692         this_arg_conv.inner = untag_ptr(this_arg);
62693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62695         this_arg_conv.is_owned = false;
62696         LDKOnionMessagePath path_conv;
62697         path_conv.inner = untag_ptr(path);
62698         path_conv.is_owned = ptr_is_owned(path);
62699         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
62700         path_conv = OnionMessagePath_clone(&path_conv);
62701         void* message_ptr = untag_ptr(message);
62702         CHECK_ACCESS(message_ptr);
62703         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
62704         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
62705         LDKBlindedPath reply_path_conv;
62706         reply_path_conv.inner = untag_ptr(reply_path);
62707         reply_path_conv.is_owned = ptr_is_owned(reply_path);
62708         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
62709         reply_path_conv = BlindedPath_clone(&reply_path_conv);
62710         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
62711         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, message_conv, reply_path_conv);
62712         return tag_ptr(ret_conv, true);
62713 }
62714
62715 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
62716         LDKOnionMessenger this_arg_conv;
62717         this_arg_conv.inner = untag_ptr(this_arg);
62718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62720         this_arg_conv.is_owned = false;
62721         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
62722         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
62723         return tag_ptr(ret_ret, true);
62724 }
62725
62726 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
62727         LDKOnionMessenger this_arg_conv;
62728         this_arg_conv.inner = untag_ptr(this_arg);
62729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62731         this_arg_conv.is_owned = false;
62732         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
62733         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
62734         return tag_ptr(ret_ret, true);
62735 }
62736
62737 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
62738         if (!ptr_is_owned(this_ptr)) return;
62739         void* this_ptr_ptr = untag_ptr(this_ptr);
62740         CHECK_ACCESS(this_ptr_ptr);
62741         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
62742         FREE(untag_ptr(this_ptr));
62743         OffersMessageHandler_free(this_ptr_conv);
62744 }
62745
62746 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
62747         if (!ptr_is_owned(this_ptr)) return;
62748         void* this_ptr_ptr = untag_ptr(this_ptr);
62749         CHECK_ACCESS(this_ptr_ptr);
62750         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
62751         FREE(untag_ptr(this_ptr));
62752         OffersMessage_free(this_ptr_conv);
62753 }
62754
62755 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
62756         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62757         *ret_copy = OffersMessage_clone(arg);
62758         uint64_t ret_ref = tag_ptr(ret_copy, true);
62759         return ret_ref;
62760 }
62761 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
62762         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
62763         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
62764         return ret_conv;
62765 }
62766
62767 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
62768         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
62769         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62770         *ret_copy = OffersMessage_clone(orig_conv);
62771         uint64_t ret_ref = tag_ptr(ret_copy, true);
62772         return ret_ref;
62773 }
62774
62775 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
62776         LDKInvoiceRequest a_conv;
62777         a_conv.inner = untag_ptr(a);
62778         a_conv.is_owned = ptr_is_owned(a);
62779         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62780         a_conv = InvoiceRequest_clone(&a_conv);
62781         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62782         *ret_copy = OffersMessage_invoice_request(a_conv);
62783         uint64_t ret_ref = tag_ptr(ret_copy, true);
62784         return ret_ref;
62785 }
62786
62787 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
62788         LDKBolt12Invoice a_conv;
62789         a_conv.inner = untag_ptr(a);
62790         a_conv.is_owned = ptr_is_owned(a);
62791         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62792         a_conv = Bolt12Invoice_clone(&a_conv);
62793         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62794         *ret_copy = OffersMessage_invoice(a_conv);
62795         uint64_t ret_ref = tag_ptr(ret_copy, true);
62796         return ret_ref;
62797 }
62798
62799 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
62800         LDKInvoiceError a_conv;
62801         a_conv.inner = untag_ptr(a);
62802         a_conv.is_owned = ptr_is_owned(a);
62803         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62804         a_conv = InvoiceError_clone(&a_conv);
62805         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62806         *ret_copy = OffersMessage_invoice_error(a_conv);
62807         uint64_t ret_ref = tag_ptr(ret_copy, true);
62808         return ret_ref;
62809 }
62810
62811 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
62812         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
62813         return ret_conv;
62814 }
62815
62816 int64_t  __attribute__((export_name("TS_OffersMessage_tlv_type"))) TS_OffersMessage_tlv_type(uint64_t this_arg) {
62817         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
62818         int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv);
62819         return ret_conv;
62820 }
62821
62822 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
62823         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
62824         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
62825         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62826         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62827         CVec_u8Z_free(ret_var);
62828         return ret_arr;
62829 }
62830
62831 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
62832         LDKu8slice ser_ref;
62833         ser_ref.datalen = ser->arr_len;
62834         ser_ref.data = ser->elems;
62835         void* arg_b_ptr = untag_ptr(arg_b);
62836         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
62837         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
62838         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
62839         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
62840         FREE(ser);
62841         return tag_ptr(ret_conv, true);
62842 }
62843
62844 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
62845         LDKPacket this_obj_conv;
62846         this_obj_conv.inner = untag_ptr(this_obj);
62847         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62849         Packet_free(this_obj_conv);
62850 }
62851
62852 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
62853         LDKPacket this_ptr_conv;
62854         this_ptr_conv.inner = untag_ptr(this_ptr);
62855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62857         this_ptr_conv.is_owned = false;
62858         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
62859         return ret_conv;
62860 }
62861
62862 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
62863         LDKPacket this_ptr_conv;
62864         this_ptr_conv.inner = untag_ptr(this_ptr);
62865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62867         this_ptr_conv.is_owned = false;
62868         Packet_set_version(&this_ptr_conv, val);
62869 }
62870
62871 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
62872         LDKPacket this_ptr_conv;
62873         this_ptr_conv.inner = untag_ptr(this_ptr);
62874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62876         this_ptr_conv.is_owned = false;
62877         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62878         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
62879         return ret_arr;
62880 }
62881
62882 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
62883         LDKPacket this_ptr_conv;
62884         this_ptr_conv.inner = untag_ptr(this_ptr);
62885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62887         this_ptr_conv.is_owned = false;
62888         LDKPublicKey val_ref;
62889         CHECK(val->arr_len == 33);
62890         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
62891         Packet_set_public_key(&this_ptr_conv, val_ref);
62892 }
62893
62894 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
62895         LDKPacket this_ptr_conv;
62896         this_ptr_conv.inner = untag_ptr(this_ptr);
62897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62899         this_ptr_conv.is_owned = false;
62900         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
62901         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62902         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62903         CVec_u8Z_free(ret_var);
62904         return ret_arr;
62905 }
62906
62907 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
62908         LDKPacket this_ptr_conv;
62909         this_ptr_conv.inner = untag_ptr(this_ptr);
62910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62912         this_ptr_conv.is_owned = false;
62913         LDKCVec_u8Z val_ref;
62914         val_ref.datalen = val->arr_len;
62915         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
62916         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
62917         Packet_set_hop_data(&this_ptr_conv, val_ref);
62918 }
62919
62920 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
62921         LDKPacket this_ptr_conv;
62922         this_ptr_conv.inner = untag_ptr(this_ptr);
62923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62925         this_ptr_conv.is_owned = false;
62926         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62927         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
62928         return ret_arr;
62929 }
62930
62931 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
62932         LDKPacket this_ptr_conv;
62933         this_ptr_conv.inner = untag_ptr(this_ptr);
62934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62936         this_ptr_conv.is_owned = false;
62937         LDKThirtyTwoBytes val_ref;
62938         CHECK(val->arr_len == 32);
62939         memcpy(val_ref.data, val->elems, 32); FREE(val);
62940         Packet_set_hmac(&this_ptr_conv, val_ref);
62941 }
62942
62943 uint64_t  __attribute__((export_name("TS_Packet_new"))) TS_Packet_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
62944         LDKPublicKey public_key_arg_ref;
62945         CHECK(public_key_arg->arr_len == 33);
62946         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
62947         LDKCVec_u8Z hop_data_arg_ref;
62948         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
62949         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
62950         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
62951         LDKThirtyTwoBytes hmac_arg_ref;
62952         CHECK(hmac_arg->arr_len == 32);
62953         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
62954         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
62955         uint64_t ret_ref = 0;
62956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62958         return ret_ref;
62959 }
62960
62961 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
62962         LDKPacket ret_var = Packet_clone(arg);
62963         uint64_t ret_ref = 0;
62964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62966         return ret_ref;
62967 }
62968 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
62969         LDKPacket arg_conv;
62970         arg_conv.inner = untag_ptr(arg);
62971         arg_conv.is_owned = ptr_is_owned(arg);
62972         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62973         arg_conv.is_owned = false;
62974         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
62975         return ret_conv;
62976 }
62977
62978 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
62979         LDKPacket orig_conv;
62980         orig_conv.inner = untag_ptr(orig);
62981         orig_conv.is_owned = ptr_is_owned(orig);
62982         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62983         orig_conv.is_owned = false;
62984         LDKPacket ret_var = Packet_clone(&orig_conv);
62985         uint64_t ret_ref = 0;
62986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62988         return ret_ref;
62989 }
62990
62991 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
62992         LDKPacket a_conv;
62993         a_conv.inner = untag_ptr(a);
62994         a_conv.is_owned = ptr_is_owned(a);
62995         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62996         a_conv.is_owned = false;
62997         LDKPacket b_conv;
62998         b_conv.inner = untag_ptr(b);
62999         b_conv.is_owned = ptr_is_owned(b);
63000         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63001         b_conv.is_owned = false;
63002         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
63003         return ret_conv;
63004 }
63005
63006 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
63007         LDKPacket obj_conv;
63008         obj_conv.inner = untag_ptr(obj);
63009         obj_conv.is_owned = ptr_is_owned(obj);
63010         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63011         obj_conv.is_owned = false;
63012         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
63013         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63014         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63015         CVec_u8Z_free(ret_var);
63016         return ret_arr;
63017 }
63018
63019 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
63020         if (!ptr_is_owned(this_ptr)) return;
63021         void* this_ptr_ptr = untag_ptr(this_ptr);
63022         CHECK_ACCESS(this_ptr_ptr);
63023         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
63024         FREE(untag_ptr(this_ptr));
63025         OnionMessageContents_free(this_ptr_conv);
63026 }
63027
63028 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
63029         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63030         *ret_copy = OnionMessageContents_clone(arg);
63031         uint64_t ret_ref = tag_ptr(ret_copy, true);
63032         return ret_ref;
63033 }
63034 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
63035         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
63036         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
63037         return ret_conv;
63038 }
63039
63040 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
63041         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
63042         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63043         *ret_copy = OnionMessageContents_clone(orig_conv);
63044         uint64_t ret_ref = tag_ptr(ret_copy, true);
63045         return ret_ref;
63046 }
63047
63048 uint64_t  __attribute__((export_name("TS_OnionMessageContents_offers"))) TS_OnionMessageContents_offers(uint64_t a) {
63049         void* a_ptr = untag_ptr(a);
63050         CHECK_ACCESS(a_ptr);
63051         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
63052         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
63053         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63054         *ret_copy = OnionMessageContents_offers(a_conv);
63055         uint64_t ret_ref = tag_ptr(ret_copy, true);
63056         return ret_ref;
63057 }
63058
63059 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
63060         void* a_ptr = untag_ptr(a);
63061         CHECK_ACCESS(a_ptr);
63062         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
63063         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
63064                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63065                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
63066         }
63067         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63068         *ret_copy = OnionMessageContents_custom(a_conv);
63069         uint64_t ret_ref = tag_ptr(ret_copy, true);
63070         return ret_ref;
63071 }
63072
63073 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
63074         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
63075         *ret_ret = CustomOnionMessageContents_clone(arg);
63076         return tag_ptr(ret_ret, true);
63077 }
63078 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
63079         void* arg_ptr = untag_ptr(arg);
63080         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
63081         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
63082         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
63083         return ret_conv;
63084 }
63085
63086 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
63087         void* orig_ptr = untag_ptr(orig);
63088         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
63089         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
63090         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
63091         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
63092         return tag_ptr(ret_ret, true);
63093 }
63094
63095 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
63096         if (!ptr_is_owned(this_ptr)) return;
63097         void* this_ptr_ptr = untag_ptr(this_ptr);
63098         CHECK_ACCESS(this_ptr_ptr);
63099         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
63100         FREE(untag_ptr(this_ptr));
63101         CustomOnionMessageContents_free(this_ptr_conv);
63102 }
63103
63104 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
63105         LDKBlindedPath this_obj_conv;
63106         this_obj_conv.inner = untag_ptr(this_obj);
63107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63109         BlindedPath_free(this_obj_conv);
63110 }
63111
63112 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_introduction_node_id"))) TS_BlindedPath_get_introduction_node_id(uint64_t this_ptr) {
63113         LDKBlindedPath this_ptr_conv;
63114         this_ptr_conv.inner = untag_ptr(this_ptr);
63115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63117         this_ptr_conv.is_owned = false;
63118         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63119         memcpy(ret_arr->elems, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form, 33);
63120         return ret_arr;
63121 }
63122
63123 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node_id"))) TS_BlindedPath_set_introduction_node_id(uint64_t this_ptr, int8_tArray val) {
63124         LDKBlindedPath this_ptr_conv;
63125         this_ptr_conv.inner = untag_ptr(this_ptr);
63126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63128         this_ptr_conv.is_owned = false;
63129         LDKPublicKey val_ref;
63130         CHECK(val->arr_len == 33);
63131         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
63132         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
63133 }
63134
63135 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
63136         LDKBlindedPath this_ptr_conv;
63137         this_ptr_conv.inner = untag_ptr(this_ptr);
63138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63140         this_ptr_conv.is_owned = false;
63141         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63142         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
63143         return ret_arr;
63144 }
63145
63146 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
63147         LDKBlindedPath this_ptr_conv;
63148         this_ptr_conv.inner = untag_ptr(this_ptr);
63149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63151         this_ptr_conv.is_owned = false;
63152         LDKPublicKey val_ref;
63153         CHECK(val->arr_len == 33);
63154         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
63155         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
63156 }
63157
63158 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
63159         LDKBlindedPath this_ptr_conv;
63160         this_ptr_conv.inner = untag_ptr(this_ptr);
63161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63163         this_ptr_conv.is_owned = false;
63164         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
63165         uint64_tArray ret_arr = NULL;
63166         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63167         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63168         for (size_t m = 0; m < ret_var.datalen; m++) {
63169                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
63170                 uint64_t ret_conv_12_ref = 0;
63171                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
63172                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
63173                 ret_arr_ptr[m] = ret_conv_12_ref;
63174         }
63175         
63176         FREE(ret_var.data);
63177         return ret_arr;
63178 }
63179
63180 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
63181         LDKBlindedPath this_ptr_conv;
63182         this_ptr_conv.inner = untag_ptr(this_ptr);
63183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63185         this_ptr_conv.is_owned = false;
63186         LDKCVec_BlindedHopZ val_constr;
63187         val_constr.datalen = val->arr_len;
63188         if (val_constr.datalen > 0)
63189                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
63190         else
63191                 val_constr.data = NULL;
63192         uint64_t* val_vals = val->elems;
63193         for (size_t m = 0; m < val_constr.datalen; m++) {
63194                 uint64_t val_conv_12 = val_vals[m];
63195                 LDKBlindedHop val_conv_12_conv;
63196                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
63197                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
63198                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
63199                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
63200                 val_constr.data[m] = val_conv_12_conv;
63201         }
63202         FREE(val);
63203         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
63204 }
63205
63206 uint64_t  __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, uint64_tArray blinded_hops_arg) {
63207         LDKPublicKey introduction_node_id_arg_ref;
63208         CHECK(introduction_node_id_arg->arr_len == 33);
63209         memcpy(introduction_node_id_arg_ref.compressed_form, introduction_node_id_arg->elems, 33); FREE(introduction_node_id_arg);
63210         LDKPublicKey blinding_point_arg_ref;
63211         CHECK(blinding_point_arg->arr_len == 33);
63212         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
63213         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
63214         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
63215         if (blinded_hops_arg_constr.datalen > 0)
63216                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
63217         else
63218                 blinded_hops_arg_constr.data = NULL;
63219         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
63220         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
63221                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
63222                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
63223                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
63224                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
63225                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
63226                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
63227                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
63228         }
63229         FREE(blinded_hops_arg);
63230         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
63231         uint64_t ret_ref = 0;
63232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63234         return ret_ref;
63235 }
63236
63237 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
63238         LDKBlindedPath ret_var = BlindedPath_clone(arg);
63239         uint64_t ret_ref = 0;
63240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63242         return ret_ref;
63243 }
63244 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
63245         LDKBlindedPath arg_conv;
63246         arg_conv.inner = untag_ptr(arg);
63247         arg_conv.is_owned = ptr_is_owned(arg);
63248         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63249         arg_conv.is_owned = false;
63250         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
63251         return ret_conv;
63252 }
63253
63254 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
63255         LDKBlindedPath orig_conv;
63256         orig_conv.inner = untag_ptr(orig);
63257         orig_conv.is_owned = ptr_is_owned(orig);
63258         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63259         orig_conv.is_owned = false;
63260         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
63261         uint64_t ret_ref = 0;
63262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63264         return ret_ref;
63265 }
63266
63267 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
63268         LDKBlindedPath o_conv;
63269         o_conv.inner = untag_ptr(o);
63270         o_conv.is_owned = ptr_is_owned(o);
63271         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63272         o_conv.is_owned = false;
63273         int64_t ret_conv = BlindedPath_hash(&o_conv);
63274         return ret_conv;
63275 }
63276
63277 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
63278         LDKBlindedPath a_conv;
63279         a_conv.inner = untag_ptr(a);
63280         a_conv.is_owned = ptr_is_owned(a);
63281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63282         a_conv.is_owned = false;
63283         LDKBlindedPath b_conv;
63284         b_conv.inner = untag_ptr(b);
63285         b_conv.is_owned = ptr_is_owned(b);
63286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63287         b_conv.is_owned = false;
63288         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
63289         return ret_conv;
63290 }
63291
63292 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
63293         LDKBlindedHop this_obj_conv;
63294         this_obj_conv.inner = untag_ptr(this_obj);
63295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63297         BlindedHop_free(this_obj_conv);
63298 }
63299
63300 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
63301         LDKBlindedHop this_ptr_conv;
63302         this_ptr_conv.inner = untag_ptr(this_ptr);
63303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63305         this_ptr_conv.is_owned = false;
63306         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63307         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
63308         return ret_arr;
63309 }
63310
63311 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
63312         LDKBlindedHop this_ptr_conv;
63313         this_ptr_conv.inner = untag_ptr(this_ptr);
63314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63316         this_ptr_conv.is_owned = false;
63317         LDKPublicKey val_ref;
63318         CHECK(val->arr_len == 33);
63319         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
63320         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
63321 }
63322
63323 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
63324         LDKBlindedHop this_ptr_conv;
63325         this_ptr_conv.inner = untag_ptr(this_ptr);
63326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63328         this_ptr_conv.is_owned = false;
63329         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
63330         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63331         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63332         CVec_u8Z_free(ret_var);
63333         return ret_arr;
63334 }
63335
63336 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
63337         LDKBlindedHop this_ptr_conv;
63338         this_ptr_conv.inner = untag_ptr(this_ptr);
63339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63341         this_ptr_conv.is_owned = false;
63342         LDKCVec_u8Z val_ref;
63343         val_ref.datalen = val->arr_len;
63344         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
63345         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
63346         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
63347 }
63348
63349 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
63350         LDKPublicKey blinded_node_id_arg_ref;
63351         CHECK(blinded_node_id_arg->arr_len == 33);
63352         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
63353         LDKCVec_u8Z encrypted_payload_arg_ref;
63354         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
63355         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
63356         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
63357         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
63358         uint64_t ret_ref = 0;
63359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63361         return ret_ref;
63362 }
63363
63364 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
63365         LDKBlindedHop ret_var = BlindedHop_clone(arg);
63366         uint64_t ret_ref = 0;
63367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63369         return ret_ref;
63370 }
63371 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
63372         LDKBlindedHop arg_conv;
63373         arg_conv.inner = untag_ptr(arg);
63374         arg_conv.is_owned = ptr_is_owned(arg);
63375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63376         arg_conv.is_owned = false;
63377         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
63378         return ret_conv;
63379 }
63380
63381 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
63382         LDKBlindedHop orig_conv;
63383         orig_conv.inner = untag_ptr(orig);
63384         orig_conv.is_owned = ptr_is_owned(orig);
63385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63386         orig_conv.is_owned = false;
63387         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
63388         uint64_t ret_ref = 0;
63389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63391         return ret_ref;
63392 }
63393
63394 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
63395         LDKBlindedHop o_conv;
63396         o_conv.inner = untag_ptr(o);
63397         o_conv.is_owned = ptr_is_owned(o);
63398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63399         o_conv.is_owned = false;
63400         int64_t ret_conv = BlindedHop_hash(&o_conv);
63401         return ret_conv;
63402 }
63403
63404 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
63405         LDKBlindedHop a_conv;
63406         a_conv.inner = untag_ptr(a);
63407         a_conv.is_owned = ptr_is_owned(a);
63408         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63409         a_conv.is_owned = false;
63410         LDKBlindedHop b_conv;
63411         b_conv.inner = untag_ptr(b);
63412         b_conv.is_owned = ptr_is_owned(b);
63413         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63414         b_conv.is_owned = false;
63415         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
63416         return ret_conv;
63417 }
63418
63419 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
63420         LDKCVec_PublicKeyZ node_pks_constr;
63421         node_pks_constr.datalen = node_pks->arr_len;
63422         if (node_pks_constr.datalen > 0)
63423                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63424         else
63425                 node_pks_constr.data = NULL;
63426         int8_tArray* node_pks_vals = (void*) node_pks->elems;
63427         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
63428                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
63429                 LDKPublicKey node_pks_conv_12_ref;
63430                 CHECK(node_pks_conv_12->arr_len == 33);
63431                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
63432                 node_pks_constr.data[m] = node_pks_conv_12_ref;
63433         }
63434         FREE(node_pks);
63435         void* entropy_source_ptr = untag_ptr(entropy_source);
63436         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
63437         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
63438         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
63439         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
63440         return tag_ptr(ret_conv, true);
63441 }
63442
63443 uint64_t  __attribute__((export_name("TS_BlindedPath_one_hop_for_payment"))) TS_BlindedPath_one_hop_for_payment(int8_tArray payee_node_id, uint64_t payee_tlvs, uint64_t entropy_source) {
63444         LDKPublicKey payee_node_id_ref;
63445         CHECK(payee_node_id->arr_len == 33);
63446         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
63447         LDKReceiveTlvs payee_tlvs_conv;
63448         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
63449         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
63450         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
63451         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
63452         void* entropy_source_ptr = untag_ptr(entropy_source);
63453         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
63454         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
63455         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
63456         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
63457         return tag_ptr(ret_conv, true);
63458 }
63459
63460 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
63461         LDKBlindedPath obj_conv;
63462         obj_conv.inner = untag_ptr(obj);
63463         obj_conv.is_owned = ptr_is_owned(obj);
63464         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63465         obj_conv.is_owned = false;
63466         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
63467         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63468         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63469         CVec_u8Z_free(ret_var);
63470         return ret_arr;
63471 }
63472
63473 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
63474         LDKu8slice ser_ref;
63475         ser_ref.datalen = ser->arr_len;
63476         ser_ref.data = ser->elems;
63477         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
63478         *ret_conv = BlindedPath_read(ser_ref);
63479         FREE(ser);
63480         return tag_ptr(ret_conv, true);
63481 }
63482
63483 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
63484         LDKBlindedHop obj_conv;
63485         obj_conv.inner = untag_ptr(obj);
63486         obj_conv.is_owned = ptr_is_owned(obj);
63487         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63488         obj_conv.is_owned = false;
63489         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
63490         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63491         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63492         CVec_u8Z_free(ret_var);
63493         return ret_arr;
63494 }
63495
63496 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
63497         LDKu8slice ser_ref;
63498         ser_ref.datalen = ser->arr_len;
63499         ser_ref.data = ser->elems;
63500         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
63501         *ret_conv = BlindedHop_read(ser_ref);
63502         FREE(ser);
63503         return tag_ptr(ret_conv, true);
63504 }
63505
63506 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
63507         LDKForwardNode this_obj_conv;
63508         this_obj_conv.inner = untag_ptr(this_obj);
63509         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63511         ForwardNode_free(this_obj_conv);
63512 }
63513
63514 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
63515         LDKForwardNode this_ptr_conv;
63516         this_ptr_conv.inner = untag_ptr(this_ptr);
63517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63519         this_ptr_conv.is_owned = false;
63520         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
63521         uint64_t ret_ref = 0;
63522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63524         return ret_ref;
63525 }
63526
63527 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
63528         LDKForwardNode this_ptr_conv;
63529         this_ptr_conv.inner = untag_ptr(this_ptr);
63530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63532         this_ptr_conv.is_owned = false;
63533         LDKForwardTlvs val_conv;
63534         val_conv.inner = untag_ptr(val);
63535         val_conv.is_owned = ptr_is_owned(val);
63536         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63537         val_conv = ForwardTlvs_clone(&val_conv);
63538         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
63539 }
63540
63541 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
63542         LDKForwardNode this_ptr_conv;
63543         this_ptr_conv.inner = untag_ptr(this_ptr);
63544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63546         this_ptr_conv.is_owned = false;
63547         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63548         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
63549         return ret_arr;
63550 }
63551
63552 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
63553         LDKForwardNode this_ptr_conv;
63554         this_ptr_conv.inner = untag_ptr(this_ptr);
63555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63557         this_ptr_conv.is_owned = false;
63558         LDKPublicKey val_ref;
63559         CHECK(val->arr_len == 33);
63560         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
63561         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
63562 }
63563
63564 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
63565         LDKForwardNode this_ptr_conv;
63566         this_ptr_conv.inner = untag_ptr(this_ptr);
63567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63569         this_ptr_conv.is_owned = false;
63570         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
63571         return ret_conv;
63572 }
63573
63574 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
63575         LDKForwardNode this_ptr_conv;
63576         this_ptr_conv.inner = untag_ptr(this_ptr);
63577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63579         this_ptr_conv.is_owned = false;
63580         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
63581 }
63582
63583 uint64_t  __attribute__((export_name("TS_ForwardNode_new"))) TS_ForwardNode_new(uint64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
63584         LDKForwardTlvs tlvs_arg_conv;
63585         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
63586         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
63587         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
63588         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
63589         LDKPublicKey node_id_arg_ref;
63590         CHECK(node_id_arg->arr_len == 33);
63591         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
63592         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
63593         uint64_t ret_ref = 0;
63594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63596         return ret_ref;
63597 }
63598
63599 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
63600         LDKForwardNode ret_var = ForwardNode_clone(arg);
63601         uint64_t ret_ref = 0;
63602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63604         return ret_ref;
63605 }
63606 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
63607         LDKForwardNode arg_conv;
63608         arg_conv.inner = untag_ptr(arg);
63609         arg_conv.is_owned = ptr_is_owned(arg);
63610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63611         arg_conv.is_owned = false;
63612         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
63613         return ret_conv;
63614 }
63615
63616 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
63617         LDKForwardNode orig_conv;
63618         orig_conv.inner = untag_ptr(orig);
63619         orig_conv.is_owned = ptr_is_owned(orig);
63620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63621         orig_conv.is_owned = false;
63622         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
63623         uint64_t ret_ref = 0;
63624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63626         return ret_ref;
63627 }
63628
63629 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
63630         LDKForwardTlvs this_obj_conv;
63631         this_obj_conv.inner = untag_ptr(this_obj);
63632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63634         ForwardTlvs_free(this_obj_conv);
63635 }
63636
63637 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
63638         LDKForwardTlvs this_ptr_conv;
63639         this_ptr_conv.inner = untag_ptr(this_ptr);
63640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63642         this_ptr_conv.is_owned = false;
63643         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
63644         return ret_conv;
63645 }
63646
63647 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
63648         LDKForwardTlvs this_ptr_conv;
63649         this_ptr_conv.inner = untag_ptr(this_ptr);
63650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63652         this_ptr_conv.is_owned = false;
63653         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
63654 }
63655
63656 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
63657         LDKForwardTlvs this_ptr_conv;
63658         this_ptr_conv.inner = untag_ptr(this_ptr);
63659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63661         this_ptr_conv.is_owned = false;
63662         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
63663         uint64_t ret_ref = 0;
63664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63666         return ret_ref;
63667 }
63668
63669 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
63670         LDKForwardTlvs this_ptr_conv;
63671         this_ptr_conv.inner = untag_ptr(this_ptr);
63672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63674         this_ptr_conv.is_owned = false;
63675         LDKPaymentRelay val_conv;
63676         val_conv.inner = untag_ptr(val);
63677         val_conv.is_owned = ptr_is_owned(val);
63678         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63679         val_conv = PaymentRelay_clone(&val_conv);
63680         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
63681 }
63682
63683 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
63684         LDKForwardTlvs this_ptr_conv;
63685         this_ptr_conv.inner = untag_ptr(this_ptr);
63686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63688         this_ptr_conv.is_owned = false;
63689         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
63690         uint64_t ret_ref = 0;
63691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63693         return ret_ref;
63694 }
63695
63696 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
63697         LDKForwardTlvs this_ptr_conv;
63698         this_ptr_conv.inner = untag_ptr(this_ptr);
63699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63701         this_ptr_conv.is_owned = false;
63702         LDKPaymentConstraints val_conv;
63703         val_conv.inner = untag_ptr(val);
63704         val_conv.is_owned = ptr_is_owned(val);
63705         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63706         val_conv = PaymentConstraints_clone(&val_conv);
63707         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
63708 }
63709
63710 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
63711         LDKForwardTlvs this_ptr_conv;
63712         this_ptr_conv.inner = untag_ptr(this_ptr);
63713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63715         this_ptr_conv.is_owned = false;
63716         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
63717         uint64_t ret_ref = 0;
63718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63720         return ret_ref;
63721 }
63722
63723 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
63724         LDKForwardTlvs this_ptr_conv;
63725         this_ptr_conv.inner = untag_ptr(this_ptr);
63726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63728         this_ptr_conv.is_owned = false;
63729         LDKBlindedHopFeatures val_conv;
63730         val_conv.inner = untag_ptr(val);
63731         val_conv.is_owned = ptr_is_owned(val);
63732         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63733         val_conv = BlindedHopFeatures_clone(&val_conv);
63734         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
63735 }
63736
63737 uint64_t  __attribute__((export_name("TS_ForwardTlvs_new"))) TS_ForwardTlvs_new(int64_t short_channel_id_arg, uint64_t payment_relay_arg, uint64_t payment_constraints_arg, uint64_t features_arg) {
63738         LDKPaymentRelay payment_relay_arg_conv;
63739         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
63740         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
63741         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
63742         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
63743         LDKPaymentConstraints payment_constraints_arg_conv;
63744         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
63745         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
63746         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
63747         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
63748         LDKBlindedHopFeatures features_arg_conv;
63749         features_arg_conv.inner = untag_ptr(features_arg);
63750         features_arg_conv.is_owned = ptr_is_owned(features_arg);
63751         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
63752         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
63753         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
63754         uint64_t ret_ref = 0;
63755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63757         return ret_ref;
63758 }
63759
63760 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
63761         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
63762         uint64_t ret_ref = 0;
63763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63765         return ret_ref;
63766 }
63767 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
63768         LDKForwardTlvs arg_conv;
63769         arg_conv.inner = untag_ptr(arg);
63770         arg_conv.is_owned = ptr_is_owned(arg);
63771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63772         arg_conv.is_owned = false;
63773         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
63774         return ret_conv;
63775 }
63776
63777 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
63778         LDKForwardTlvs orig_conv;
63779         orig_conv.inner = untag_ptr(orig);
63780         orig_conv.is_owned = ptr_is_owned(orig);
63781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63782         orig_conv.is_owned = false;
63783         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
63784         uint64_t ret_ref = 0;
63785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63787         return ret_ref;
63788 }
63789
63790 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
63791         LDKReceiveTlvs this_obj_conv;
63792         this_obj_conv.inner = untag_ptr(this_obj);
63793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63795         ReceiveTlvs_free(this_obj_conv);
63796 }
63797
63798 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
63799         LDKReceiveTlvs this_ptr_conv;
63800         this_ptr_conv.inner = untag_ptr(this_ptr);
63801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63803         this_ptr_conv.is_owned = false;
63804         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63805         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
63806         return ret_arr;
63807 }
63808
63809 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
63810         LDKReceiveTlvs this_ptr_conv;
63811         this_ptr_conv.inner = untag_ptr(this_ptr);
63812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63814         this_ptr_conv.is_owned = false;
63815         LDKThirtyTwoBytes val_ref;
63816         CHECK(val->arr_len == 32);
63817         memcpy(val_ref.data, val->elems, 32); FREE(val);
63818         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
63819 }
63820
63821 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
63822         LDKReceiveTlvs this_ptr_conv;
63823         this_ptr_conv.inner = untag_ptr(this_ptr);
63824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63826         this_ptr_conv.is_owned = false;
63827         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
63828         uint64_t ret_ref = 0;
63829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63831         return ret_ref;
63832 }
63833
63834 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
63835         LDKReceiveTlvs this_ptr_conv;
63836         this_ptr_conv.inner = untag_ptr(this_ptr);
63837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63839         this_ptr_conv.is_owned = false;
63840         LDKPaymentConstraints val_conv;
63841         val_conv.inner = untag_ptr(val);
63842         val_conv.is_owned = ptr_is_owned(val);
63843         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63844         val_conv = PaymentConstraints_clone(&val_conv);
63845         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
63846 }
63847
63848 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_new"))) TS_ReceiveTlvs_new(int8_tArray payment_secret_arg, uint64_t payment_constraints_arg) {
63849         LDKThirtyTwoBytes payment_secret_arg_ref;
63850         CHECK(payment_secret_arg->arr_len == 32);
63851         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
63852         LDKPaymentConstraints payment_constraints_arg_conv;
63853         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
63854         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
63855         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
63856         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
63857         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
63858         uint64_t ret_ref = 0;
63859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63861         return ret_ref;
63862 }
63863
63864 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
63865         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
63866         uint64_t ret_ref = 0;
63867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63869         return ret_ref;
63870 }
63871 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
63872         LDKReceiveTlvs arg_conv;
63873         arg_conv.inner = untag_ptr(arg);
63874         arg_conv.is_owned = ptr_is_owned(arg);
63875         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63876         arg_conv.is_owned = false;
63877         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
63878         return ret_conv;
63879 }
63880
63881 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
63882         LDKReceiveTlvs orig_conv;
63883         orig_conv.inner = untag_ptr(orig);
63884         orig_conv.is_owned = ptr_is_owned(orig);
63885         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63886         orig_conv.is_owned = false;
63887         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
63888         uint64_t ret_ref = 0;
63889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63891         return ret_ref;
63892 }
63893
63894 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
63895         LDKPaymentRelay this_obj_conv;
63896         this_obj_conv.inner = untag_ptr(this_obj);
63897         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63899         PaymentRelay_free(this_obj_conv);
63900 }
63901
63902 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
63903         LDKPaymentRelay this_ptr_conv;
63904         this_ptr_conv.inner = untag_ptr(this_ptr);
63905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63907         this_ptr_conv.is_owned = false;
63908         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
63909         return ret_conv;
63910 }
63911
63912 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
63913         LDKPaymentRelay this_ptr_conv;
63914         this_ptr_conv.inner = untag_ptr(this_ptr);
63915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63917         this_ptr_conv.is_owned = false;
63918         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
63919 }
63920
63921 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
63922         LDKPaymentRelay this_ptr_conv;
63923         this_ptr_conv.inner = untag_ptr(this_ptr);
63924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63926         this_ptr_conv.is_owned = false;
63927         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
63928         return ret_conv;
63929 }
63930
63931 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
63932         LDKPaymentRelay this_ptr_conv;
63933         this_ptr_conv.inner = untag_ptr(this_ptr);
63934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63936         this_ptr_conv.is_owned = false;
63937         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
63938 }
63939
63940 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
63941         LDKPaymentRelay this_ptr_conv;
63942         this_ptr_conv.inner = untag_ptr(this_ptr);
63943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63945         this_ptr_conv.is_owned = false;
63946         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
63947         return ret_conv;
63948 }
63949
63950 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
63951         LDKPaymentRelay this_ptr_conv;
63952         this_ptr_conv.inner = untag_ptr(this_ptr);
63953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63955         this_ptr_conv.is_owned = false;
63956         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
63957 }
63958
63959 uint64_t  __attribute__((export_name("TS_PaymentRelay_new"))) TS_PaymentRelay_new(int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
63960         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
63961         uint64_t ret_ref = 0;
63962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63964         return ret_ref;
63965 }
63966
63967 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
63968         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
63969         uint64_t ret_ref = 0;
63970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63972         return ret_ref;
63973 }
63974 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
63975         LDKPaymentRelay arg_conv;
63976         arg_conv.inner = untag_ptr(arg);
63977         arg_conv.is_owned = ptr_is_owned(arg);
63978         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63979         arg_conv.is_owned = false;
63980         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
63981         return ret_conv;
63982 }
63983
63984 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
63985         LDKPaymentRelay orig_conv;
63986         orig_conv.inner = untag_ptr(orig);
63987         orig_conv.is_owned = ptr_is_owned(orig);
63988         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63989         orig_conv.is_owned = false;
63990         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
63991         uint64_t ret_ref = 0;
63992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63994         return ret_ref;
63995 }
63996
63997 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
63998         LDKPaymentConstraints this_obj_conv;
63999         this_obj_conv.inner = untag_ptr(this_obj);
64000         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64002         PaymentConstraints_free(this_obj_conv);
64003 }
64004
64005 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
64006         LDKPaymentConstraints this_ptr_conv;
64007         this_ptr_conv.inner = untag_ptr(this_ptr);
64008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64010         this_ptr_conv.is_owned = false;
64011         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
64012         return ret_conv;
64013 }
64014
64015 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
64016         LDKPaymentConstraints this_ptr_conv;
64017         this_ptr_conv.inner = untag_ptr(this_ptr);
64018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64020         this_ptr_conv.is_owned = false;
64021         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
64022 }
64023
64024 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
64025         LDKPaymentConstraints this_ptr_conv;
64026         this_ptr_conv.inner = untag_ptr(this_ptr);
64027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64029         this_ptr_conv.is_owned = false;
64030         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
64031         return ret_conv;
64032 }
64033
64034 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
64035         LDKPaymentConstraints this_ptr_conv;
64036         this_ptr_conv.inner = untag_ptr(this_ptr);
64037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64039         this_ptr_conv.is_owned = false;
64040         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
64041 }
64042
64043 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
64044         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
64045         uint64_t ret_ref = 0;
64046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64048         return ret_ref;
64049 }
64050
64051 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
64052         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
64053         uint64_t ret_ref = 0;
64054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64056         return ret_ref;
64057 }
64058 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
64059         LDKPaymentConstraints arg_conv;
64060         arg_conv.inner = untag_ptr(arg);
64061         arg_conv.is_owned = ptr_is_owned(arg);
64062         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64063         arg_conv.is_owned = false;
64064         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
64065         return ret_conv;
64066 }
64067
64068 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
64069         LDKPaymentConstraints orig_conv;
64070         orig_conv.inner = untag_ptr(orig);
64071         orig_conv.is_owned = ptr_is_owned(orig);
64072         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64073         orig_conv.is_owned = false;
64074         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
64075         uint64_t ret_ref = 0;
64076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64078         return ret_ref;
64079 }
64080
64081 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
64082         LDKForwardTlvs obj_conv;
64083         obj_conv.inner = untag_ptr(obj);
64084         obj_conv.is_owned = ptr_is_owned(obj);
64085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64086         obj_conv.is_owned = false;
64087         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
64088         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64089         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64090         CVec_u8Z_free(ret_var);
64091         return ret_arr;
64092 }
64093
64094 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
64095         LDKReceiveTlvs obj_conv;
64096         obj_conv.inner = untag_ptr(obj);
64097         obj_conv.is_owned = ptr_is_owned(obj);
64098         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64099         obj_conv.is_owned = false;
64100         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
64101         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64102         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64103         CVec_u8Z_free(ret_var);
64104         return ret_arr;
64105 }
64106
64107 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_read"))) TS_ReceiveTlvs_read(int8_tArray ser) {
64108         LDKu8slice ser_ref;
64109         ser_ref.datalen = ser->arr_len;
64110         ser_ref.data = ser->elems;
64111         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
64112         *ret_conv = ReceiveTlvs_read(ser_ref);
64113         FREE(ser);
64114         return tag_ptr(ret_conv, true);
64115 }
64116
64117 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
64118         LDKPaymentRelay obj_conv;
64119         obj_conv.inner = untag_ptr(obj);
64120         obj_conv.is_owned = ptr_is_owned(obj);
64121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64122         obj_conv.is_owned = false;
64123         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
64124         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64125         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64126         CVec_u8Z_free(ret_var);
64127         return ret_arr;
64128 }
64129
64130 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
64131         LDKu8slice ser_ref;
64132         ser_ref.datalen = ser->arr_len;
64133         ser_ref.data = ser->elems;
64134         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
64135         *ret_conv = PaymentRelay_read(ser_ref);
64136         FREE(ser);
64137         return tag_ptr(ret_conv, true);
64138 }
64139
64140 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
64141         LDKPaymentConstraints obj_conv;
64142         obj_conv.inner = untag_ptr(obj);
64143         obj_conv.is_owned = ptr_is_owned(obj);
64144         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64145         obj_conv.is_owned = false;
64146         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
64147         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64148         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64149         CVec_u8Z_free(ret_var);
64150         return ret_arr;
64151 }
64152
64153 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
64154         LDKu8slice ser_ref;
64155         ser_ref.datalen = ser->arr_len;
64156         ser_ref.data = ser->elems;
64157         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
64158         *ret_conv = PaymentConstraints_read(ser_ref);
64159         FREE(ser);
64160         return tag_ptr(ret_conv, true);
64161 }
64162
64163 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
64164         if (!ptr_is_owned(this_ptr)) return;
64165         void* this_ptr_ptr = untag_ptr(this_ptr);
64166         CHECK_ACCESS(this_ptr_ptr);
64167         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
64168         FREE(untag_ptr(this_ptr));
64169         PaymentPurpose_free(this_ptr_conv);
64170 }
64171
64172 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
64173         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64174         *ret_copy = PaymentPurpose_clone(arg);
64175         uint64_t ret_ref = tag_ptr(ret_copy, true);
64176         return ret_ref;
64177 }
64178 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
64179         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
64180         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
64181         return ret_conv;
64182 }
64183
64184 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
64185         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
64186         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64187         *ret_copy = PaymentPurpose_clone(orig_conv);
64188         uint64_t ret_ref = tag_ptr(ret_copy, true);
64189         return ret_ref;
64190 }
64191
64192 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
64193         void* payment_preimage_ptr = untag_ptr(payment_preimage);
64194         CHECK_ACCESS(payment_preimage_ptr);
64195         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
64196         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
64197         LDKThirtyTwoBytes payment_secret_ref;
64198         CHECK(payment_secret->arr_len == 32);
64199         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
64200         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64201         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
64202         uint64_t ret_ref = tag_ptr(ret_copy, true);
64203         return ret_ref;
64204 }
64205
64206 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
64207         LDKThirtyTwoBytes a_ref;
64208         CHECK(a->arr_len == 32);
64209         memcpy(a_ref.data, a->elems, 32); FREE(a);
64210         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64211         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
64212         uint64_t ret_ref = tag_ptr(ret_copy, true);
64213         return ret_ref;
64214 }
64215
64216 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
64217         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
64218         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
64219         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
64220         return ret_conv;
64221 }
64222
64223 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
64224         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
64225         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
64226         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64227         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64228         CVec_u8Z_free(ret_var);
64229         return ret_arr;
64230 }
64231
64232 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
64233         LDKu8slice ser_ref;
64234         ser_ref.datalen = ser->arr_len;
64235         ser_ref.data = ser->elems;
64236         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
64237         *ret_conv = PaymentPurpose_read(ser_ref);
64238         FREE(ser);
64239         return tag_ptr(ret_conv, true);
64240 }
64241
64242 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
64243         LDKClaimedHTLC this_obj_conv;
64244         this_obj_conv.inner = untag_ptr(this_obj);
64245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64247         ClaimedHTLC_free(this_obj_conv);
64248 }
64249
64250 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
64251         LDKClaimedHTLC this_ptr_conv;
64252         this_ptr_conv.inner = untag_ptr(this_ptr);
64253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64255         this_ptr_conv.is_owned = false;
64256         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64257         memcpy(ret_arr->elems, *ClaimedHTLC_get_channel_id(&this_ptr_conv), 32);
64258         return ret_arr;
64259 }
64260
64261 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
64262         LDKClaimedHTLC this_ptr_conv;
64263         this_ptr_conv.inner = untag_ptr(this_ptr);
64264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64266         this_ptr_conv.is_owned = false;
64267         LDKThirtyTwoBytes val_ref;
64268         CHECK(val->arr_len == 32);
64269         memcpy(val_ref.data, val->elems, 32); FREE(val);
64270         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
64271 }
64272
64273 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
64274         LDKClaimedHTLC this_ptr_conv;
64275         this_ptr_conv.inner = untag_ptr(this_ptr);
64276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64278         this_ptr_conv.is_owned = false;
64279         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
64280         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
64281         return ret_arr;
64282 }
64283
64284 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
64285         LDKClaimedHTLC this_ptr_conv;
64286         this_ptr_conv.inner = untag_ptr(this_ptr);
64287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64289         this_ptr_conv.is_owned = false;
64290         LDKU128 val_ref;
64291         CHECK(val->arr_len == 16);
64292         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
64293         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
64294 }
64295
64296 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
64297         LDKClaimedHTLC this_ptr_conv;
64298         this_ptr_conv.inner = untag_ptr(this_ptr);
64299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64301         this_ptr_conv.is_owned = false;
64302         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
64303         return ret_conv;
64304 }
64305
64306 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
64307         LDKClaimedHTLC this_ptr_conv;
64308         this_ptr_conv.inner = untag_ptr(this_ptr);
64309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64311         this_ptr_conv.is_owned = false;
64312         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
64313 }
64314
64315 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
64316         LDKClaimedHTLC this_ptr_conv;
64317         this_ptr_conv.inner = untag_ptr(this_ptr);
64318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64320         this_ptr_conv.is_owned = false;
64321         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
64322         return ret_conv;
64323 }
64324
64325 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
64326         LDKClaimedHTLC this_ptr_conv;
64327         this_ptr_conv.inner = untag_ptr(this_ptr);
64328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64330         this_ptr_conv.is_owned = false;
64331         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
64332 }
64333
64334 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_new"))) TS_ClaimedHTLC_new(int8_tArray channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg) {
64335         LDKThirtyTwoBytes channel_id_arg_ref;
64336         CHECK(channel_id_arg->arr_len == 32);
64337         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
64338         LDKU128 user_channel_id_arg_ref;
64339         CHECK(user_channel_id_arg->arr_len == 16);
64340         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
64341         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg);
64342         uint64_t ret_ref = 0;
64343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64345         return ret_ref;
64346 }
64347
64348 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
64349         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
64350         uint64_t ret_ref = 0;
64351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64353         return ret_ref;
64354 }
64355 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
64356         LDKClaimedHTLC arg_conv;
64357         arg_conv.inner = untag_ptr(arg);
64358         arg_conv.is_owned = ptr_is_owned(arg);
64359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64360         arg_conv.is_owned = false;
64361         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
64362         return ret_conv;
64363 }
64364
64365 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
64366         LDKClaimedHTLC orig_conv;
64367         orig_conv.inner = untag_ptr(orig);
64368         orig_conv.is_owned = ptr_is_owned(orig);
64369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64370         orig_conv.is_owned = false;
64371         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
64372         uint64_t ret_ref = 0;
64373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64375         return ret_ref;
64376 }
64377
64378 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
64379         LDKClaimedHTLC a_conv;
64380         a_conv.inner = untag_ptr(a);
64381         a_conv.is_owned = ptr_is_owned(a);
64382         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64383         a_conv.is_owned = false;
64384         LDKClaimedHTLC b_conv;
64385         b_conv.inner = untag_ptr(b);
64386         b_conv.is_owned = ptr_is_owned(b);
64387         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64388         b_conv.is_owned = false;
64389         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
64390         return ret_conv;
64391 }
64392
64393 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
64394         LDKClaimedHTLC obj_conv;
64395         obj_conv.inner = untag_ptr(obj);
64396         obj_conv.is_owned = ptr_is_owned(obj);
64397         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64398         obj_conv.is_owned = false;
64399         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
64400         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64401         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64402         CVec_u8Z_free(ret_var);
64403         return ret_arr;
64404 }
64405
64406 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
64407         LDKu8slice ser_ref;
64408         ser_ref.datalen = ser->arr_len;
64409         ser_ref.data = ser->elems;
64410         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
64411         *ret_conv = ClaimedHTLC_read(ser_ref);
64412         FREE(ser);
64413         return tag_ptr(ret_conv, true);
64414 }
64415
64416 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
64417         if (!ptr_is_owned(this_ptr)) return;
64418         void* this_ptr_ptr = untag_ptr(this_ptr);
64419         CHECK_ACCESS(this_ptr_ptr);
64420         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
64421         FREE(untag_ptr(this_ptr));
64422         PathFailure_free(this_ptr_conv);
64423 }
64424
64425 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
64426         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64427         *ret_copy = PathFailure_clone(arg);
64428         uint64_t ret_ref = tag_ptr(ret_copy, true);
64429         return ret_ref;
64430 }
64431 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
64432         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
64433         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
64434         return ret_conv;
64435 }
64436
64437 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
64438         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
64439         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64440         *ret_copy = PathFailure_clone(orig_conv);
64441         uint64_t ret_ref = tag_ptr(ret_copy, true);
64442         return ret_ref;
64443 }
64444
64445 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
64446         void* err_ptr = untag_ptr(err);
64447         CHECK_ACCESS(err_ptr);
64448         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
64449         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
64450         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64451         *ret_copy = PathFailure_initial_send(err_conv);
64452         uint64_t ret_ref = tag_ptr(ret_copy, true);
64453         return ret_ref;
64454 }
64455
64456 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
64457         void* network_update_ptr = untag_ptr(network_update);
64458         CHECK_ACCESS(network_update_ptr);
64459         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
64460         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
64461         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64462         *ret_copy = PathFailure_on_path(network_update_conv);
64463         uint64_t ret_ref = tag_ptr(ret_copy, true);
64464         return ret_ref;
64465 }
64466
64467 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
64468         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
64469         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
64470         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
64471         return ret_conv;
64472 }
64473
64474 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
64475         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
64476         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
64477         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64478         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64479         CVec_u8Z_free(ret_var);
64480         return ret_arr;
64481 }
64482
64483 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
64484         LDKu8slice ser_ref;
64485         ser_ref.datalen = ser->arr_len;
64486         ser_ref.data = ser->elems;
64487         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
64488         *ret_conv = PathFailure_read(ser_ref);
64489         FREE(ser);
64490         return tag_ptr(ret_conv, true);
64491 }
64492
64493 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
64494         if (!ptr_is_owned(this_ptr)) return;
64495         void* this_ptr_ptr = untag_ptr(this_ptr);
64496         CHECK_ACCESS(this_ptr_ptr);
64497         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
64498         FREE(untag_ptr(this_ptr));
64499         ClosureReason_free(this_ptr_conv);
64500 }
64501
64502 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
64503         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64504         *ret_copy = ClosureReason_clone(arg);
64505         uint64_t ret_ref = tag_ptr(ret_copy, true);
64506         return ret_ref;
64507 }
64508 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
64509         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
64510         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
64511         return ret_conv;
64512 }
64513
64514 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
64515         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
64516         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64517         *ret_copy = ClosureReason_clone(orig_conv);
64518         uint64_t ret_ref = tag_ptr(ret_copy, true);
64519         return ret_ref;
64520 }
64521
64522 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
64523         LDKUntrustedString peer_msg_conv;
64524         peer_msg_conv.inner = untag_ptr(peer_msg);
64525         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
64526         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
64527         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
64528         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64529         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
64530         uint64_t ret_ref = tag_ptr(ret_copy, true);
64531         return ret_ref;
64532 }
64533
64534 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
64535         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64536         *ret_copy = ClosureReason_holder_force_closed();
64537         uint64_t ret_ref = tag_ptr(ret_copy, true);
64538         return ret_ref;
64539 }
64540
64541 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
64542         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64543         *ret_copy = ClosureReason_cooperative_closure();
64544         uint64_t ret_ref = tag_ptr(ret_copy, true);
64545         return ret_ref;
64546 }
64547
64548 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
64549         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64550         *ret_copy = ClosureReason_commitment_tx_confirmed();
64551         uint64_t ret_ref = tag_ptr(ret_copy, true);
64552         return ret_ref;
64553 }
64554
64555 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
64556         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64557         *ret_copy = ClosureReason_funding_timed_out();
64558         uint64_t ret_ref = tag_ptr(ret_copy, true);
64559         return ret_ref;
64560 }
64561
64562 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
64563         LDKStr err_conv = str_ref_to_owned_c(err);
64564         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64565         *ret_copy = ClosureReason_processing_error(err_conv);
64566         uint64_t ret_ref = tag_ptr(ret_copy, true);
64567         return ret_ref;
64568 }
64569
64570 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
64571         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64572         *ret_copy = ClosureReason_disconnected_peer();
64573         uint64_t ret_ref = tag_ptr(ret_copy, true);
64574         return ret_ref;
64575 }
64576
64577 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
64578         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64579         *ret_copy = ClosureReason_outdated_channel_manager();
64580         uint64_t ret_ref = tag_ptr(ret_copy, true);
64581         return ret_ref;
64582 }
64583
64584 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
64585         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64586         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
64587         uint64_t ret_ref = tag_ptr(ret_copy, true);
64588         return ret_ref;
64589 }
64590
64591 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
64592         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64593         *ret_copy = ClosureReason_funding_batch_closure();
64594         uint64_t ret_ref = tag_ptr(ret_copy, true);
64595         return ret_ref;
64596 }
64597
64598 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
64599         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
64600         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
64601         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
64602         return ret_conv;
64603 }
64604
64605 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
64606         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
64607         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
64608         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64609         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64610         CVec_u8Z_free(ret_var);
64611         return ret_arr;
64612 }
64613
64614 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
64615         LDKu8slice ser_ref;
64616         ser_ref.datalen = ser->arr_len;
64617         ser_ref.data = ser->elems;
64618         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
64619         *ret_conv = ClosureReason_read(ser_ref);
64620         FREE(ser);
64621         return tag_ptr(ret_conv, true);
64622 }
64623
64624 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
64625         if (!ptr_is_owned(this_ptr)) return;
64626         void* this_ptr_ptr = untag_ptr(this_ptr);
64627         CHECK_ACCESS(this_ptr_ptr);
64628         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
64629         FREE(untag_ptr(this_ptr));
64630         HTLCDestination_free(this_ptr_conv);
64631 }
64632
64633 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
64634         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64635         *ret_copy = HTLCDestination_clone(arg);
64636         uint64_t ret_ref = tag_ptr(ret_copy, true);
64637         return ret_ref;
64638 }
64639 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
64640         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
64641         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
64642         return ret_conv;
64643 }
64644
64645 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
64646         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
64647         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64648         *ret_copy = HTLCDestination_clone(orig_conv);
64649         uint64_t ret_ref = tag_ptr(ret_copy, true);
64650         return ret_ref;
64651 }
64652
64653 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
64654         LDKPublicKey node_id_ref;
64655         CHECK(node_id->arr_len == 33);
64656         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
64657         LDKThirtyTwoBytes channel_id_ref;
64658         CHECK(channel_id->arr_len == 32);
64659         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
64660         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64661         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
64662         uint64_t ret_ref = tag_ptr(ret_copy, true);
64663         return ret_ref;
64664 }
64665
64666 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
64667         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64668         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
64669         uint64_t ret_ref = tag_ptr(ret_copy, true);
64670         return ret_ref;
64671 }
64672
64673 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
64674         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64675         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
64676         uint64_t ret_ref = tag_ptr(ret_copy, true);
64677         return ret_ref;
64678 }
64679
64680 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
64681         LDKThirtyTwoBytes payment_hash_ref;
64682         CHECK(payment_hash->arr_len == 32);
64683         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64684         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64685         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
64686         uint64_t ret_ref = tag_ptr(ret_copy, true);
64687         return ret_ref;
64688 }
64689
64690 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
64691         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
64692         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
64693         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
64694         return ret_conv;
64695 }
64696
64697 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
64698         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
64699         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
64700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64702         CVec_u8Z_free(ret_var);
64703         return ret_arr;
64704 }
64705
64706 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
64707         LDKu8slice ser_ref;
64708         ser_ref.datalen = ser->arr_len;
64709         ser_ref.data = ser->elems;
64710         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
64711         *ret_conv = HTLCDestination_read(ser_ref);
64712         FREE(ser);
64713         return tag_ptr(ret_conv, true);
64714 }
64715
64716 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
64717         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
64718         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
64719         return ret_conv;
64720 }
64721
64722 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
64723         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
64724         return ret_conv;
64725 }
64726
64727 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
64728         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
64729         return ret_conv;
64730 }
64731
64732 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
64733         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
64734         return ret_conv;
64735 }
64736
64737 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
64738         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
64739         return ret_conv;
64740 }
64741
64742 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
64743         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
64744         return ret_conv;
64745 }
64746
64747 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
64748         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
64749         return ret_conv;
64750 }
64751
64752 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
64753         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
64754         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
64755         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
64756         return ret_conv;
64757 }
64758
64759 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
64760         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
64761         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
64762         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64763         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64764         CVec_u8Z_free(ret_var);
64765         return ret_arr;
64766 }
64767
64768 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
64769         LDKu8slice ser_ref;
64770         ser_ref.datalen = ser->arr_len;
64771         ser_ref.data = ser->elems;
64772         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
64773         *ret_conv = PaymentFailureReason_read(ser_ref);
64774         FREE(ser);
64775         return tag_ptr(ret_conv, true);
64776 }
64777
64778 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
64779         if (!ptr_is_owned(this_ptr)) return;
64780         void* this_ptr_ptr = untag_ptr(this_ptr);
64781         CHECK_ACCESS(this_ptr_ptr);
64782         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
64783         FREE(untag_ptr(this_ptr));
64784         Event_free(this_ptr_conv);
64785 }
64786
64787 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
64788         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64789         *ret_copy = Event_clone(arg);
64790         uint64_t ret_ref = tag_ptr(ret_copy, true);
64791         return ret_ref;
64792 }
64793 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
64794         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
64795         int64_t ret_conv = Event_clone_ptr(arg_conv);
64796         return ret_conv;
64797 }
64798
64799 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
64800         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
64801         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64802         *ret_copy = Event_clone(orig_conv);
64803         uint64_t ret_ref = tag_ptr(ret_copy, true);
64804         return ret_ref;
64805 }
64806
64807 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) {
64808         LDKThirtyTwoBytes temporary_channel_id_ref;
64809         CHECK(temporary_channel_id->arr_len == 32);
64810         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
64811         LDKPublicKey counterparty_node_id_ref;
64812         CHECK(counterparty_node_id->arr_len == 33);
64813         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
64814         LDKCVec_u8Z output_script_ref;
64815         output_script_ref.datalen = output_script->arr_len;
64816         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
64817         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
64818         LDKU128 user_channel_id_ref;
64819         CHECK(user_channel_id->arr_len == 16);
64820         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
64821         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64822         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
64823         uint64_t ret_ref = tag_ptr(ret_copy, true);
64824         return ret_ref;
64825 }
64826
64827 uint64_t  __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, uint64_t onion_fields, int64_t amount_msat, int64_t counterparty_skimmed_fee_msat, uint64_t purpose, uint64_t via_channel_id, uint64_t via_user_channel_id, uint64_t claim_deadline) {
64828         LDKPublicKey receiver_node_id_ref;
64829         CHECK(receiver_node_id->arr_len == 33);
64830         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
64831         LDKThirtyTwoBytes payment_hash_ref;
64832         CHECK(payment_hash->arr_len == 32);
64833         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64834         LDKRecipientOnionFields onion_fields_conv;
64835         onion_fields_conv.inner = untag_ptr(onion_fields);
64836         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
64837         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
64838         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
64839         void* purpose_ptr = untag_ptr(purpose);
64840         CHECK_ACCESS(purpose_ptr);
64841         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
64842         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
64843         void* via_channel_id_ptr = untag_ptr(via_channel_id);
64844         CHECK_ACCESS(via_channel_id_ptr);
64845         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
64846         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
64847         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
64848         CHECK_ACCESS(via_user_channel_id_ptr);
64849         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
64850         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
64851         void* claim_deadline_ptr = untag_ptr(claim_deadline);
64852         CHECK_ACCESS(claim_deadline_ptr);
64853         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
64854         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
64855         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64856         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, counterparty_skimmed_fee_msat, purpose_conv, via_channel_id_conv, via_user_channel_id_conv, claim_deadline_conv);
64857         uint64_t ret_ref = tag_ptr(ret_copy, true);
64858         return ret_ref;
64859 }
64860
64861 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose, uint64_tArray htlcs, uint64_t sender_intended_total_msat) {
64862         LDKPublicKey receiver_node_id_ref;
64863         CHECK(receiver_node_id->arr_len == 33);
64864         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
64865         LDKThirtyTwoBytes payment_hash_ref;
64866         CHECK(payment_hash->arr_len == 32);
64867         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64868         void* purpose_ptr = untag_ptr(purpose);
64869         CHECK_ACCESS(purpose_ptr);
64870         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
64871         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
64872         LDKCVec_ClaimedHTLCZ htlcs_constr;
64873         htlcs_constr.datalen = htlcs->arr_len;
64874         if (htlcs_constr.datalen > 0)
64875                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
64876         else
64877                 htlcs_constr.data = NULL;
64878         uint64_t* htlcs_vals = htlcs->elems;
64879         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
64880                 uint64_t htlcs_conv_13 = htlcs_vals[n];
64881                 LDKClaimedHTLC htlcs_conv_13_conv;
64882                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
64883                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
64884                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
64885                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
64886                 htlcs_constr.data[n] = htlcs_conv_13_conv;
64887         }
64888         FREE(htlcs);
64889         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
64890         CHECK_ACCESS(sender_intended_total_msat_ptr);
64891         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
64892         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
64893         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64894         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
64895         uint64_t ret_ref = tag_ptr(ret_copy, true);
64896         return ret_ref;
64897 }
64898
64899 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) {
64900         void* payment_id_ptr = untag_ptr(payment_id);
64901         CHECK_ACCESS(payment_id_ptr);
64902         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
64903         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
64904         LDKThirtyTwoBytes payment_preimage_ref;
64905         CHECK(payment_preimage->arr_len == 32);
64906         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
64907         LDKThirtyTwoBytes payment_hash_ref;
64908         CHECK(payment_hash->arr_len == 32);
64909         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64910         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
64911         CHECK_ACCESS(fee_paid_msat_ptr);
64912         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
64913         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
64914         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64915         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
64916         uint64_t ret_ref = tag_ptr(ret_copy, true);
64917         return ret_ref;
64918 }
64919
64920 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
64921         LDKThirtyTwoBytes payment_id_ref;
64922         CHECK(payment_id->arr_len == 32);
64923         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64924         LDKThirtyTwoBytes payment_hash_ref;
64925         CHECK(payment_hash->arr_len == 32);
64926         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64927         void* reason_ptr = untag_ptr(reason);
64928         CHECK_ACCESS(reason_ptr);
64929         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
64930         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
64931         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64932         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
64933         uint64_t ret_ref = tag_ptr(ret_copy, true);
64934         return ret_ref;
64935 }
64936
64937 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) {
64938         LDKThirtyTwoBytes payment_id_ref;
64939         CHECK(payment_id->arr_len == 32);
64940         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64941         void* payment_hash_ptr = untag_ptr(payment_hash);
64942         CHECK_ACCESS(payment_hash_ptr);
64943         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
64944         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
64945         LDKPath path_conv;
64946         path_conv.inner = untag_ptr(path);
64947         path_conv.is_owned = ptr_is_owned(path);
64948         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64949         path_conv = Path_clone(&path_conv);
64950         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64951         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
64952         uint64_t ret_ref = tag_ptr(ret_copy, true);
64953         return ret_ref;
64954 }
64955
64956 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) {
64957         void* payment_id_ptr = untag_ptr(payment_id);
64958         CHECK_ACCESS(payment_id_ptr);
64959         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
64960         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
64961         LDKThirtyTwoBytes payment_hash_ref;
64962         CHECK(payment_hash->arr_len == 32);
64963         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64964         void* failure_ptr = untag_ptr(failure);
64965         CHECK_ACCESS(failure_ptr);
64966         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
64967         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
64968         LDKPath path_conv;
64969         path_conv.inner = untag_ptr(path);
64970         path_conv.is_owned = ptr_is_owned(path);
64971         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64972         path_conv = Path_clone(&path_conv);
64973         void* short_channel_id_ptr = untag_ptr(short_channel_id);
64974         CHECK_ACCESS(short_channel_id_ptr);
64975         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
64976         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
64977         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64978         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
64979         uint64_t ret_ref = tag_ptr(ret_copy, true);
64980         return ret_ref;
64981 }
64982
64983 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
64984         LDKThirtyTwoBytes payment_id_ref;
64985         CHECK(payment_id->arr_len == 32);
64986         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64987         LDKThirtyTwoBytes payment_hash_ref;
64988         CHECK(payment_hash->arr_len == 32);
64989         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64990         LDKPath path_conv;
64991         path_conv.inner = untag_ptr(path);
64992         path_conv.is_owned = ptr_is_owned(path);
64993         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64994         path_conv = Path_clone(&path_conv);
64995         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64996         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
64997         uint64_t ret_ref = tag_ptr(ret_copy, true);
64998         return ret_ref;
64999 }
65000
65001 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) {
65002         LDKThirtyTwoBytes payment_id_ref;
65003         CHECK(payment_id->arr_len == 32);
65004         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
65005         LDKThirtyTwoBytes payment_hash_ref;
65006         CHECK(payment_hash->arr_len == 32);
65007         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
65008         LDKPath path_conv;
65009         path_conv.inner = untag_ptr(path);
65010         path_conv.is_owned = ptr_is_owned(path);
65011         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
65012         path_conv = Path_clone(&path_conv);
65013         void* short_channel_id_ptr = untag_ptr(short_channel_id);
65014         CHECK_ACCESS(short_channel_id_ptr);
65015         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
65016         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
65017         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65018         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
65019         uint64_t ret_ref = tag_ptr(ret_copy, true);
65020         return ret_ref;
65021 }
65022
65023 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
65024         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65025         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
65026         uint64_t ret_ref = tag_ptr(ret_copy, true);
65027         return ret_ref;
65028 }
65029
65030 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) {
65031         LDKThirtyTwoBytes intercept_id_ref;
65032         CHECK(intercept_id->arr_len == 32);
65033         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
65034         LDKThirtyTwoBytes payment_hash_ref;
65035         CHECK(payment_hash->arr_len == 32);
65036         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
65037         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65038         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
65039         uint64_t ret_ref = tag_ptr(ret_copy, true);
65040         return ret_ref;
65041 }
65042
65043 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
65044         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
65045         outputs_constr.datalen = outputs->arr_len;
65046         if (outputs_constr.datalen > 0)
65047                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
65048         else
65049                 outputs_constr.data = NULL;
65050         uint64_t* outputs_vals = outputs->elems;
65051         for (size_t b = 0; b < outputs_constr.datalen; b++) {
65052                 uint64_t outputs_conv_27 = outputs_vals[b];
65053                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
65054                 CHECK_ACCESS(outputs_conv_27_ptr);
65055                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
65056                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
65057                 outputs_constr.data[b] = outputs_conv_27_conv;
65058         }
65059         FREE(outputs);
65060         void* channel_id_ptr = untag_ptr(channel_id);
65061         CHECK_ACCESS(channel_id_ptr);
65062         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
65063         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
65064         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65065         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
65066         uint64_t ret_ref = tag_ptr(ret_copy, true);
65067         return ret_ref;
65068 }
65069
65070 uint64_t  __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(uint64_t prev_channel_id, uint64_t next_channel_id, uint64_t fee_earned_msat, jboolean claim_from_onchain_tx, uint64_t outbound_amount_forwarded_msat) {
65071         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
65072         CHECK_ACCESS(prev_channel_id_ptr);
65073         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
65074         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
65075         void* next_channel_id_ptr = untag_ptr(next_channel_id);
65076         CHECK_ACCESS(next_channel_id_ptr);
65077         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
65078         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
65079         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
65080         CHECK_ACCESS(fee_earned_msat_ptr);
65081         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
65082         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
65083         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
65084         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
65085         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
65086         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
65087         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65088         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
65089         uint64_t ret_ref = tag_ptr(ret_copy, true);
65090         return ret_ref;
65091 }
65092
65093 uint64_t  __attribute__((export_name("TS_Event_channel_pending"))) TS_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t former_temporary_channel_id, int8_tArray counterparty_node_id, uint64_t funding_txo) {
65094         LDKThirtyTwoBytes channel_id_ref;
65095         CHECK(channel_id->arr_len == 32);
65096         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65097         LDKU128 user_channel_id_ref;
65098         CHECK(user_channel_id->arr_len == 16);
65099         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
65100         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
65101         CHECK_ACCESS(former_temporary_channel_id_ptr);
65102         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
65103         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
65104         LDKPublicKey counterparty_node_id_ref;
65105         CHECK(counterparty_node_id->arr_len == 33);
65106         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
65107         LDKOutPoint funding_txo_conv;
65108         funding_txo_conv.inner = untag_ptr(funding_txo);
65109         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
65110         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
65111         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
65112         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65113         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
65114         uint64_t ret_ref = tag_ptr(ret_copy, true);
65115         return ret_ref;
65116 }
65117
65118 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) {
65119         LDKThirtyTwoBytes channel_id_ref;
65120         CHECK(channel_id->arr_len == 32);
65121         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65122         LDKU128 user_channel_id_ref;
65123         CHECK(user_channel_id->arr_len == 16);
65124         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
65125         LDKPublicKey counterparty_node_id_ref;
65126         CHECK(counterparty_node_id->arr_len == 33);
65127         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
65128         LDKChannelTypeFeatures channel_type_conv;
65129         channel_type_conv.inner = untag_ptr(channel_type);
65130         channel_type_conv.is_owned = ptr_is_owned(channel_type);
65131         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
65132         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
65133         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65134         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
65135         uint64_t ret_ref = tag_ptr(ret_copy, true);
65136         return ret_ref;
65137 }
65138
65139 uint64_t  __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t reason, int8_tArray counterparty_node_id, uint64_t channel_capacity_sats) {
65140         LDKThirtyTwoBytes channel_id_ref;
65141         CHECK(channel_id->arr_len == 32);
65142         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65143         LDKU128 user_channel_id_ref;
65144         CHECK(user_channel_id->arr_len == 16);
65145         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
65146         void* reason_ptr = untag_ptr(reason);
65147         CHECK_ACCESS(reason_ptr);
65148         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
65149         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
65150         LDKPublicKey counterparty_node_id_ref;
65151         CHECK(counterparty_node_id->arr_len == 33);
65152         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
65153         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
65154         CHECK_ACCESS(channel_capacity_sats_ptr);
65155         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
65156         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
65157         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65158         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv);
65159         uint64_t ret_ref = tag_ptr(ret_copy, true);
65160         return ret_ref;
65161 }
65162
65163 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
65164         LDKThirtyTwoBytes channel_id_ref;
65165         CHECK(channel_id->arr_len == 32);
65166         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65167         LDKTransaction transaction_ref;
65168         transaction_ref.datalen = transaction->arr_len;
65169         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
65170         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
65171         transaction_ref.data_is_owned = true;
65172         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65173         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
65174         uint64_t ret_ref = tag_ptr(ret_copy, true);
65175         return ret_ref;
65176 }
65177
65178 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) {
65179         LDKThirtyTwoBytes temporary_channel_id_ref;
65180         CHECK(temporary_channel_id->arr_len == 32);
65181         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
65182         LDKPublicKey counterparty_node_id_ref;
65183         CHECK(counterparty_node_id->arr_len == 33);
65184         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
65185         LDKChannelTypeFeatures channel_type_conv;
65186         channel_type_conv.inner = untag_ptr(channel_type);
65187         channel_type_conv.is_owned = ptr_is_owned(channel_type);
65188         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
65189         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
65190         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65191         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
65192         uint64_t ret_ref = tag_ptr(ret_copy, true);
65193         return ret_ref;
65194 }
65195
65196 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
65197         LDKThirtyTwoBytes prev_channel_id_ref;
65198         CHECK(prev_channel_id->arr_len == 32);
65199         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
65200         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
65201         CHECK_ACCESS(failed_next_destination_ptr);
65202         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
65203         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
65204         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65205         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
65206         uint64_t ret_ref = tag_ptr(ret_copy, true);
65207         return ret_ref;
65208 }
65209
65210 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
65211         void* a_ptr = untag_ptr(a);
65212         CHECK_ACCESS(a_ptr);
65213         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
65214         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
65215         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65216         *ret_copy = Event_bump_transaction(a_conv);
65217         uint64_t ret_ref = tag_ptr(ret_copy, true);
65218         return ret_ref;
65219 }
65220
65221 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
65222         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
65223         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
65224         jboolean ret_conv = Event_eq(a_conv, b_conv);
65225         return ret_conv;
65226 }
65227
65228 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
65229         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
65230         LDKCVec_u8Z ret_var = Event_write(obj_conv);
65231         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65232         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65233         CVec_u8Z_free(ret_var);
65234         return ret_arr;
65235 }
65236
65237 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
65238         LDKu8slice ser_ref;
65239         ser_ref.datalen = ser->arr_len;
65240         ser_ref.data = ser->elems;
65241         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
65242         *ret_conv = Event_read(ser_ref);
65243         FREE(ser);
65244         return tag_ptr(ret_conv, true);
65245 }
65246
65247 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
65248         if (!ptr_is_owned(this_ptr)) return;
65249         void* this_ptr_ptr = untag_ptr(this_ptr);
65250         CHECK_ACCESS(this_ptr_ptr);
65251         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
65252         FREE(untag_ptr(this_ptr));
65253         MessageSendEvent_free(this_ptr_conv);
65254 }
65255
65256 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
65257         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65258         *ret_copy = MessageSendEvent_clone(arg);
65259         uint64_t ret_ref = tag_ptr(ret_copy, true);
65260         return ret_ref;
65261 }
65262 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
65263         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
65264         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
65265         return ret_conv;
65266 }
65267
65268 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
65269         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
65270         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65271         *ret_copy = MessageSendEvent_clone(orig_conv);
65272         uint64_t ret_ref = tag_ptr(ret_copy, true);
65273         return ret_ref;
65274 }
65275
65276 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
65277         LDKPublicKey node_id_ref;
65278         CHECK(node_id->arr_len == 33);
65279         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65280         LDKAcceptChannel msg_conv;
65281         msg_conv.inner = untag_ptr(msg);
65282         msg_conv.is_owned = ptr_is_owned(msg);
65283         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65284         msg_conv = AcceptChannel_clone(&msg_conv);
65285         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65286         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
65287         uint64_t ret_ref = tag_ptr(ret_copy, true);
65288         return ret_ref;
65289 }
65290
65291 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
65292         LDKPublicKey node_id_ref;
65293         CHECK(node_id->arr_len == 33);
65294         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65295         LDKAcceptChannelV2 msg_conv;
65296         msg_conv.inner = untag_ptr(msg);
65297         msg_conv.is_owned = ptr_is_owned(msg);
65298         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65299         msg_conv = AcceptChannelV2_clone(&msg_conv);
65300         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65301         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
65302         uint64_t ret_ref = tag_ptr(ret_copy, true);
65303         return ret_ref;
65304 }
65305
65306 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
65307         LDKPublicKey node_id_ref;
65308         CHECK(node_id->arr_len == 33);
65309         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65310         LDKOpenChannel msg_conv;
65311         msg_conv.inner = untag_ptr(msg);
65312         msg_conv.is_owned = ptr_is_owned(msg);
65313         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65314         msg_conv = OpenChannel_clone(&msg_conv);
65315         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65316         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
65317         uint64_t ret_ref = tag_ptr(ret_copy, true);
65318         return ret_ref;
65319 }
65320
65321 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
65322         LDKPublicKey node_id_ref;
65323         CHECK(node_id->arr_len == 33);
65324         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65325         LDKOpenChannelV2 msg_conv;
65326         msg_conv.inner = untag_ptr(msg);
65327         msg_conv.is_owned = ptr_is_owned(msg);
65328         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65329         msg_conv = OpenChannelV2_clone(&msg_conv);
65330         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65331         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
65332         uint64_t ret_ref = tag_ptr(ret_copy, true);
65333         return ret_ref;
65334 }
65335
65336 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
65337         LDKPublicKey node_id_ref;
65338         CHECK(node_id->arr_len == 33);
65339         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65340         LDKFundingCreated msg_conv;
65341         msg_conv.inner = untag_ptr(msg);
65342         msg_conv.is_owned = ptr_is_owned(msg);
65343         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65344         msg_conv = FundingCreated_clone(&msg_conv);
65345         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65346         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
65347         uint64_t ret_ref = tag_ptr(ret_copy, true);
65348         return ret_ref;
65349 }
65350
65351 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
65352         LDKPublicKey node_id_ref;
65353         CHECK(node_id->arr_len == 33);
65354         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65355         LDKFundingSigned msg_conv;
65356         msg_conv.inner = untag_ptr(msg);
65357         msg_conv.is_owned = ptr_is_owned(msg);
65358         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65359         msg_conv = FundingSigned_clone(&msg_conv);
65360         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65361         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
65362         uint64_t ret_ref = tag_ptr(ret_copy, true);
65363         return ret_ref;
65364 }
65365
65366 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
65367         LDKPublicKey node_id_ref;
65368         CHECK(node_id->arr_len == 33);
65369         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65370         LDKTxAddInput msg_conv;
65371         msg_conv.inner = untag_ptr(msg);
65372         msg_conv.is_owned = ptr_is_owned(msg);
65373         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65374         msg_conv = TxAddInput_clone(&msg_conv);
65375         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65376         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
65377         uint64_t ret_ref = tag_ptr(ret_copy, true);
65378         return ret_ref;
65379 }
65380
65381 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
65382         LDKPublicKey node_id_ref;
65383         CHECK(node_id->arr_len == 33);
65384         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65385         LDKTxAddOutput msg_conv;
65386         msg_conv.inner = untag_ptr(msg);
65387         msg_conv.is_owned = ptr_is_owned(msg);
65388         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65389         msg_conv = TxAddOutput_clone(&msg_conv);
65390         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65391         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
65392         uint64_t ret_ref = tag_ptr(ret_copy, true);
65393         return ret_ref;
65394 }
65395
65396 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
65397         LDKPublicKey node_id_ref;
65398         CHECK(node_id->arr_len == 33);
65399         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65400         LDKTxRemoveInput msg_conv;
65401         msg_conv.inner = untag_ptr(msg);
65402         msg_conv.is_owned = ptr_is_owned(msg);
65403         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65404         msg_conv = TxRemoveInput_clone(&msg_conv);
65405         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65406         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
65407         uint64_t ret_ref = tag_ptr(ret_copy, true);
65408         return ret_ref;
65409 }
65410
65411 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
65412         LDKPublicKey node_id_ref;
65413         CHECK(node_id->arr_len == 33);
65414         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65415         LDKTxRemoveOutput msg_conv;
65416         msg_conv.inner = untag_ptr(msg);
65417         msg_conv.is_owned = ptr_is_owned(msg);
65418         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65419         msg_conv = TxRemoveOutput_clone(&msg_conv);
65420         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65421         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
65422         uint64_t ret_ref = tag_ptr(ret_copy, true);
65423         return ret_ref;
65424 }
65425
65426 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
65427         LDKPublicKey node_id_ref;
65428         CHECK(node_id->arr_len == 33);
65429         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65430         LDKTxComplete msg_conv;
65431         msg_conv.inner = untag_ptr(msg);
65432         msg_conv.is_owned = ptr_is_owned(msg);
65433         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65434         msg_conv = TxComplete_clone(&msg_conv);
65435         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65436         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
65437         uint64_t ret_ref = tag_ptr(ret_copy, true);
65438         return ret_ref;
65439 }
65440
65441 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
65442         LDKPublicKey node_id_ref;
65443         CHECK(node_id->arr_len == 33);
65444         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65445         LDKTxSignatures msg_conv;
65446         msg_conv.inner = untag_ptr(msg);
65447         msg_conv.is_owned = ptr_is_owned(msg);
65448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65449         msg_conv = TxSignatures_clone(&msg_conv);
65450         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65451         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
65452         uint64_t ret_ref = tag_ptr(ret_copy, true);
65453         return ret_ref;
65454 }
65455
65456 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
65457         LDKPublicKey node_id_ref;
65458         CHECK(node_id->arr_len == 33);
65459         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65460         LDKTxInitRbf msg_conv;
65461         msg_conv.inner = untag_ptr(msg);
65462         msg_conv.is_owned = ptr_is_owned(msg);
65463         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65464         msg_conv = TxInitRbf_clone(&msg_conv);
65465         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65466         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
65467         uint64_t ret_ref = tag_ptr(ret_copy, true);
65468         return ret_ref;
65469 }
65470
65471 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
65472         LDKPublicKey node_id_ref;
65473         CHECK(node_id->arr_len == 33);
65474         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65475         LDKTxAckRbf msg_conv;
65476         msg_conv.inner = untag_ptr(msg);
65477         msg_conv.is_owned = ptr_is_owned(msg);
65478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65479         msg_conv = TxAckRbf_clone(&msg_conv);
65480         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65481         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
65482         uint64_t ret_ref = tag_ptr(ret_copy, true);
65483         return ret_ref;
65484 }
65485
65486 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
65487         LDKPublicKey node_id_ref;
65488         CHECK(node_id->arr_len == 33);
65489         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65490         LDKTxAbort msg_conv;
65491         msg_conv.inner = untag_ptr(msg);
65492         msg_conv.is_owned = ptr_is_owned(msg);
65493         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65494         msg_conv = TxAbort_clone(&msg_conv);
65495         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65496         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
65497         uint64_t ret_ref = tag_ptr(ret_copy, true);
65498         return ret_ref;
65499 }
65500
65501 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
65502         LDKPublicKey node_id_ref;
65503         CHECK(node_id->arr_len == 33);
65504         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65505         LDKChannelReady msg_conv;
65506         msg_conv.inner = untag_ptr(msg);
65507         msg_conv.is_owned = ptr_is_owned(msg);
65508         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65509         msg_conv = ChannelReady_clone(&msg_conv);
65510         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65511         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
65512         uint64_t ret_ref = tag_ptr(ret_copy, true);
65513         return ret_ref;
65514 }
65515
65516 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
65517         LDKPublicKey node_id_ref;
65518         CHECK(node_id->arr_len == 33);
65519         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65520         LDKAnnouncementSignatures msg_conv;
65521         msg_conv.inner = untag_ptr(msg);
65522         msg_conv.is_owned = ptr_is_owned(msg);
65523         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65524         msg_conv = AnnouncementSignatures_clone(&msg_conv);
65525         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65526         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
65527         uint64_t ret_ref = tag_ptr(ret_copy, true);
65528         return ret_ref;
65529 }
65530
65531 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
65532         LDKPublicKey node_id_ref;
65533         CHECK(node_id->arr_len == 33);
65534         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65535         LDKCommitmentUpdate updates_conv;
65536         updates_conv.inner = untag_ptr(updates);
65537         updates_conv.is_owned = ptr_is_owned(updates);
65538         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
65539         updates_conv = CommitmentUpdate_clone(&updates_conv);
65540         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65541         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
65542         uint64_t ret_ref = tag_ptr(ret_copy, true);
65543         return ret_ref;
65544 }
65545
65546 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
65547         LDKPublicKey node_id_ref;
65548         CHECK(node_id->arr_len == 33);
65549         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65550         LDKRevokeAndACK msg_conv;
65551         msg_conv.inner = untag_ptr(msg);
65552         msg_conv.is_owned = ptr_is_owned(msg);
65553         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65554         msg_conv = RevokeAndACK_clone(&msg_conv);
65555         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65556         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
65557         uint64_t ret_ref = tag_ptr(ret_copy, true);
65558         return ret_ref;
65559 }
65560
65561 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
65562         LDKPublicKey node_id_ref;
65563         CHECK(node_id->arr_len == 33);
65564         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65565         LDKClosingSigned msg_conv;
65566         msg_conv.inner = untag_ptr(msg);
65567         msg_conv.is_owned = ptr_is_owned(msg);
65568         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65569         msg_conv = ClosingSigned_clone(&msg_conv);
65570         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65571         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
65572         uint64_t ret_ref = tag_ptr(ret_copy, true);
65573         return ret_ref;
65574 }
65575
65576 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
65577         LDKPublicKey node_id_ref;
65578         CHECK(node_id->arr_len == 33);
65579         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65580         LDKShutdown msg_conv;
65581         msg_conv.inner = untag_ptr(msg);
65582         msg_conv.is_owned = ptr_is_owned(msg);
65583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65584         msg_conv = Shutdown_clone(&msg_conv);
65585         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65586         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
65587         uint64_t ret_ref = tag_ptr(ret_copy, true);
65588         return ret_ref;
65589 }
65590
65591 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
65592         LDKPublicKey node_id_ref;
65593         CHECK(node_id->arr_len == 33);
65594         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65595         LDKChannelReestablish msg_conv;
65596         msg_conv.inner = untag_ptr(msg);
65597         msg_conv.is_owned = ptr_is_owned(msg);
65598         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65599         msg_conv = ChannelReestablish_clone(&msg_conv);
65600         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65601         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
65602         uint64_t ret_ref = tag_ptr(ret_copy, true);
65603         return ret_ref;
65604 }
65605
65606 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) {
65607         LDKPublicKey node_id_ref;
65608         CHECK(node_id->arr_len == 33);
65609         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65610         LDKChannelAnnouncement msg_conv;
65611         msg_conv.inner = untag_ptr(msg);
65612         msg_conv.is_owned = ptr_is_owned(msg);
65613         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65614         msg_conv = ChannelAnnouncement_clone(&msg_conv);
65615         LDKChannelUpdate update_msg_conv;
65616         update_msg_conv.inner = untag_ptr(update_msg);
65617         update_msg_conv.is_owned = ptr_is_owned(update_msg);
65618         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
65619         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
65620         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65621         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
65622         uint64_t ret_ref = tag_ptr(ret_copy, true);
65623         return ret_ref;
65624 }
65625
65626 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
65627         LDKChannelAnnouncement msg_conv;
65628         msg_conv.inner = untag_ptr(msg);
65629         msg_conv.is_owned = ptr_is_owned(msg);
65630         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65631         msg_conv = ChannelAnnouncement_clone(&msg_conv);
65632         LDKChannelUpdate update_msg_conv;
65633         update_msg_conv.inner = untag_ptr(update_msg);
65634         update_msg_conv.is_owned = ptr_is_owned(update_msg);
65635         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
65636         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
65637         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65638         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
65639         uint64_t ret_ref = tag_ptr(ret_copy, true);
65640         return ret_ref;
65641 }
65642
65643 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
65644         LDKChannelUpdate msg_conv;
65645         msg_conv.inner = untag_ptr(msg);
65646         msg_conv.is_owned = ptr_is_owned(msg);
65647         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65648         msg_conv = ChannelUpdate_clone(&msg_conv);
65649         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65650         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
65651         uint64_t ret_ref = tag_ptr(ret_copy, true);
65652         return ret_ref;
65653 }
65654
65655 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
65656         LDKNodeAnnouncement msg_conv;
65657         msg_conv.inner = untag_ptr(msg);
65658         msg_conv.is_owned = ptr_is_owned(msg);
65659         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65660         msg_conv = NodeAnnouncement_clone(&msg_conv);
65661         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65662         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
65663         uint64_t ret_ref = tag_ptr(ret_copy, true);
65664         return ret_ref;
65665 }
65666
65667 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
65668         LDKPublicKey node_id_ref;
65669         CHECK(node_id->arr_len == 33);
65670         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65671         LDKChannelUpdate msg_conv;
65672         msg_conv.inner = untag_ptr(msg);
65673         msg_conv.is_owned = ptr_is_owned(msg);
65674         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65675         msg_conv = ChannelUpdate_clone(&msg_conv);
65676         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65677         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
65678         uint64_t ret_ref = tag_ptr(ret_copy, true);
65679         return ret_ref;
65680 }
65681
65682 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
65683         LDKPublicKey node_id_ref;
65684         CHECK(node_id->arr_len == 33);
65685         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65686         void* action_ptr = untag_ptr(action);
65687         CHECK_ACCESS(action_ptr);
65688         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
65689         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
65690         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65691         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
65692         uint64_t ret_ref = tag_ptr(ret_copy, true);
65693         return ret_ref;
65694 }
65695
65696 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
65697         LDKPublicKey node_id_ref;
65698         CHECK(node_id->arr_len == 33);
65699         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65700         LDKQueryChannelRange msg_conv;
65701         msg_conv.inner = untag_ptr(msg);
65702         msg_conv.is_owned = ptr_is_owned(msg);
65703         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65704         msg_conv = QueryChannelRange_clone(&msg_conv);
65705         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65706         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
65707         uint64_t ret_ref = tag_ptr(ret_copy, true);
65708         return ret_ref;
65709 }
65710
65711 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
65712         LDKPublicKey node_id_ref;
65713         CHECK(node_id->arr_len == 33);
65714         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65715         LDKQueryShortChannelIds msg_conv;
65716         msg_conv.inner = untag_ptr(msg);
65717         msg_conv.is_owned = ptr_is_owned(msg);
65718         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65719         msg_conv = QueryShortChannelIds_clone(&msg_conv);
65720         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65721         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
65722         uint64_t ret_ref = tag_ptr(ret_copy, true);
65723         return ret_ref;
65724 }
65725
65726 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
65727         LDKPublicKey node_id_ref;
65728         CHECK(node_id->arr_len == 33);
65729         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65730         LDKReplyChannelRange msg_conv;
65731         msg_conv.inner = untag_ptr(msg);
65732         msg_conv.is_owned = ptr_is_owned(msg);
65733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65734         msg_conv = ReplyChannelRange_clone(&msg_conv);
65735         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65736         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
65737         uint64_t ret_ref = tag_ptr(ret_copy, true);
65738         return ret_ref;
65739 }
65740
65741 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
65742         LDKPublicKey node_id_ref;
65743         CHECK(node_id->arr_len == 33);
65744         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65745         LDKGossipTimestampFilter msg_conv;
65746         msg_conv.inner = untag_ptr(msg);
65747         msg_conv.is_owned = ptr_is_owned(msg);
65748         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65749         msg_conv = GossipTimestampFilter_clone(&msg_conv);
65750         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65751         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
65752         uint64_t ret_ref = tag_ptr(ret_copy, true);
65753         return ret_ref;
65754 }
65755
65756 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
65757         if (!ptr_is_owned(this_ptr)) return;
65758         void* this_ptr_ptr = untag_ptr(this_ptr);
65759         CHECK_ACCESS(this_ptr_ptr);
65760         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
65761         FREE(untag_ptr(this_ptr));
65762         MessageSendEventsProvider_free(this_ptr_conv);
65763 }
65764
65765 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
65766         if (!ptr_is_owned(this_ptr)) return;
65767         void* this_ptr_ptr = untag_ptr(this_ptr);
65768         CHECK_ACCESS(this_ptr_ptr);
65769         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
65770         FREE(untag_ptr(this_ptr));
65771         OnionMessageProvider_free(this_ptr_conv);
65772 }
65773
65774 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
65775         if (!ptr_is_owned(this_ptr)) return;
65776         void* this_ptr_ptr = untag_ptr(this_ptr);
65777         CHECK_ACCESS(this_ptr_ptr);
65778         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
65779         FREE(untag_ptr(this_ptr));
65780         EventsProvider_free(this_ptr_conv);
65781 }
65782
65783 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
65784         if (!ptr_is_owned(this_ptr)) return;
65785         void* this_ptr_ptr = untag_ptr(this_ptr);
65786         CHECK_ACCESS(this_ptr_ptr);
65787         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
65788         FREE(untag_ptr(this_ptr));
65789         EventHandler_free(this_ptr_conv);
65790 }
65791
65792 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
65793         LDKChannelDerivationParameters this_obj_conv;
65794         this_obj_conv.inner = untag_ptr(this_obj);
65795         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65797         ChannelDerivationParameters_free(this_obj_conv);
65798 }
65799
65800 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
65801         LDKChannelDerivationParameters this_ptr_conv;
65802         this_ptr_conv.inner = untag_ptr(this_ptr);
65803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65805         this_ptr_conv.is_owned = false;
65806         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
65807         return ret_conv;
65808 }
65809
65810 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
65811         LDKChannelDerivationParameters this_ptr_conv;
65812         this_ptr_conv.inner = untag_ptr(this_ptr);
65813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65815         this_ptr_conv.is_owned = false;
65816         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
65817 }
65818
65819 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
65820         LDKChannelDerivationParameters this_ptr_conv;
65821         this_ptr_conv.inner = untag_ptr(this_ptr);
65822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65824         this_ptr_conv.is_owned = false;
65825         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65826         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
65827         return ret_arr;
65828 }
65829
65830 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
65831         LDKChannelDerivationParameters this_ptr_conv;
65832         this_ptr_conv.inner = untag_ptr(this_ptr);
65833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65835         this_ptr_conv.is_owned = false;
65836         LDKThirtyTwoBytes val_ref;
65837         CHECK(val->arr_len == 32);
65838         memcpy(val_ref.data, val->elems, 32); FREE(val);
65839         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
65840 }
65841
65842 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
65843         LDKChannelDerivationParameters this_ptr_conv;
65844         this_ptr_conv.inner = untag_ptr(this_ptr);
65845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65847         this_ptr_conv.is_owned = false;
65848         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
65849         uint64_t ret_ref = 0;
65850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65852         return ret_ref;
65853 }
65854
65855 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
65856         LDKChannelDerivationParameters this_ptr_conv;
65857         this_ptr_conv.inner = untag_ptr(this_ptr);
65858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65860         this_ptr_conv.is_owned = false;
65861         LDKChannelTransactionParameters val_conv;
65862         val_conv.inner = untag_ptr(val);
65863         val_conv.is_owned = ptr_is_owned(val);
65864         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65865         val_conv = ChannelTransactionParameters_clone(&val_conv);
65866         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
65867 }
65868
65869 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) {
65870         LDKThirtyTwoBytes keys_id_arg_ref;
65871         CHECK(keys_id_arg->arr_len == 32);
65872         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
65873         LDKChannelTransactionParameters transaction_parameters_arg_conv;
65874         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
65875         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
65876         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
65877         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
65878         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
65879         uint64_t ret_ref = 0;
65880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65882         return ret_ref;
65883 }
65884
65885 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
65886         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
65887         uint64_t ret_ref = 0;
65888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65890         return ret_ref;
65891 }
65892 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
65893         LDKChannelDerivationParameters arg_conv;
65894         arg_conv.inner = untag_ptr(arg);
65895         arg_conv.is_owned = ptr_is_owned(arg);
65896         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65897         arg_conv.is_owned = false;
65898         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
65899         return ret_conv;
65900 }
65901
65902 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
65903         LDKChannelDerivationParameters orig_conv;
65904         orig_conv.inner = untag_ptr(orig);
65905         orig_conv.is_owned = ptr_is_owned(orig);
65906         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65907         orig_conv.is_owned = false;
65908         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
65909         uint64_t ret_ref = 0;
65910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65912         return ret_ref;
65913 }
65914
65915 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
65916         LDKChannelDerivationParameters a_conv;
65917         a_conv.inner = untag_ptr(a);
65918         a_conv.is_owned = ptr_is_owned(a);
65919         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65920         a_conv.is_owned = false;
65921         LDKChannelDerivationParameters b_conv;
65922         b_conv.inner = untag_ptr(b);
65923         b_conv.is_owned = ptr_is_owned(b);
65924         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65925         b_conv.is_owned = false;
65926         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
65927         return ret_conv;
65928 }
65929
65930 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
65931         LDKChannelDerivationParameters obj_conv;
65932         obj_conv.inner = untag_ptr(obj);
65933         obj_conv.is_owned = ptr_is_owned(obj);
65934         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65935         obj_conv.is_owned = false;
65936         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
65937         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65938         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65939         CVec_u8Z_free(ret_var);
65940         return ret_arr;
65941 }
65942
65943 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
65944         LDKu8slice ser_ref;
65945         ser_ref.datalen = ser->arr_len;
65946         ser_ref.data = ser->elems;
65947         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
65948         *ret_conv = ChannelDerivationParameters_read(ser_ref);
65949         FREE(ser);
65950         return tag_ptr(ret_conv, true);
65951 }
65952
65953 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
65954         LDKAnchorDescriptor this_obj_conv;
65955         this_obj_conv.inner = untag_ptr(this_obj);
65956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65958         AnchorDescriptor_free(this_obj_conv);
65959 }
65960
65961 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
65962         LDKAnchorDescriptor this_ptr_conv;
65963         this_ptr_conv.inner = untag_ptr(this_ptr);
65964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65966         this_ptr_conv.is_owned = false;
65967         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
65968         uint64_t ret_ref = 0;
65969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65971         return ret_ref;
65972 }
65973
65974 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
65975         LDKAnchorDescriptor this_ptr_conv;
65976         this_ptr_conv.inner = untag_ptr(this_ptr);
65977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65979         this_ptr_conv.is_owned = false;
65980         LDKChannelDerivationParameters val_conv;
65981         val_conv.inner = untag_ptr(val);
65982         val_conv.is_owned = ptr_is_owned(val);
65983         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65984         val_conv = ChannelDerivationParameters_clone(&val_conv);
65985         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
65986 }
65987
65988 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
65989         LDKAnchorDescriptor this_ptr_conv;
65990         this_ptr_conv.inner = untag_ptr(this_ptr);
65991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65993         this_ptr_conv.is_owned = false;
65994         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
65995         uint64_t ret_ref = 0;
65996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65998         return ret_ref;
65999 }
66000
66001 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
66002         LDKAnchorDescriptor this_ptr_conv;
66003         this_ptr_conv.inner = untag_ptr(this_ptr);
66004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66006         this_ptr_conv.is_owned = false;
66007         LDKOutPoint val_conv;
66008         val_conv.inner = untag_ptr(val);
66009         val_conv.is_owned = ptr_is_owned(val);
66010         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66011         val_conv = OutPoint_clone(&val_conv);
66012         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
66013 }
66014
66015 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
66016         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
66017         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
66018         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
66019         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
66020         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
66021         LDKOutPoint outpoint_arg_conv;
66022         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66023         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66024         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66025         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66026         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
66027         uint64_t ret_ref = 0;
66028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66030         return ret_ref;
66031 }
66032
66033 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
66034         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
66035         uint64_t ret_ref = 0;
66036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66038         return ret_ref;
66039 }
66040 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
66041         LDKAnchorDescriptor arg_conv;
66042         arg_conv.inner = untag_ptr(arg);
66043         arg_conv.is_owned = ptr_is_owned(arg);
66044         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66045         arg_conv.is_owned = false;
66046         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
66047         return ret_conv;
66048 }
66049
66050 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
66051         LDKAnchorDescriptor orig_conv;
66052         orig_conv.inner = untag_ptr(orig);
66053         orig_conv.is_owned = ptr_is_owned(orig);
66054         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66055         orig_conv.is_owned = false;
66056         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
66057         uint64_t ret_ref = 0;
66058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66060         return ret_ref;
66061 }
66062
66063 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
66064         LDKAnchorDescriptor a_conv;
66065         a_conv.inner = untag_ptr(a);
66066         a_conv.is_owned = ptr_is_owned(a);
66067         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66068         a_conv.is_owned = false;
66069         LDKAnchorDescriptor b_conv;
66070         b_conv.inner = untag_ptr(b);
66071         b_conv.is_owned = ptr_is_owned(b);
66072         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66073         b_conv.is_owned = false;
66074         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
66075         return ret_conv;
66076 }
66077
66078 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
66079         LDKAnchorDescriptor this_arg_conv;
66080         this_arg_conv.inner = untag_ptr(this_arg);
66081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66083         this_arg_conv.is_owned = false;
66084         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66085         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
66086         return tag_ptr(ret_ref, true);
66087 }
66088
66089 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
66090         LDKAnchorDescriptor this_arg_conv;
66091         this_arg_conv.inner = untag_ptr(this_arg);
66092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66094         this_arg_conv.is_owned = false;
66095         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
66096         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
66097         return tag_ptr(ret_ref, true);
66098 }
66099
66100 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
66101         LDKAnchorDescriptor this_arg_conv;
66102         this_arg_conv.inner = untag_ptr(this_arg);
66103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66105         this_arg_conv.is_owned = false;
66106         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
66107         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66108         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66109         CVec_u8Z_free(ret_var);
66110         return ret_arr;
66111 }
66112
66113 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
66114         LDKAnchorDescriptor this_arg_conv;
66115         this_arg_conv.inner = untag_ptr(this_arg);
66116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66118         this_arg_conv.is_owned = false;
66119         LDKECDSASignature signature_ref;
66120         CHECK(signature->arr_len == 64);
66121         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
66122         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
66123         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66124         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66125         Witness_free(ret_var);
66126         return ret_arr;
66127 }
66128
66129 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
66130         LDKAnchorDescriptor this_arg_conv;
66131         this_arg_conv.inner = untag_ptr(this_arg);
66132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66134         this_arg_conv.is_owned = false;
66135         void* signer_provider_ptr = untag_ptr(signer_provider);
66136         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
66137         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
66138         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66139         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
66140         return tag_ptr(ret_ret, true);
66141 }
66142
66143 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
66144         LDKHTLCDescriptor this_obj_conv;
66145         this_obj_conv.inner = untag_ptr(this_obj);
66146         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66148         HTLCDescriptor_free(this_obj_conv);
66149 }
66150
66151 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
66152         LDKHTLCDescriptor this_ptr_conv;
66153         this_ptr_conv.inner = untag_ptr(this_ptr);
66154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66156         this_ptr_conv.is_owned = false;
66157         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
66158         uint64_t ret_ref = 0;
66159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66161         return ret_ref;
66162 }
66163
66164 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
66165         LDKHTLCDescriptor this_ptr_conv;
66166         this_ptr_conv.inner = untag_ptr(this_ptr);
66167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66169         this_ptr_conv.is_owned = false;
66170         LDKChannelDerivationParameters val_conv;
66171         val_conv.inner = untag_ptr(val);
66172         val_conv.is_owned = ptr_is_owned(val);
66173         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66174         val_conv = ChannelDerivationParameters_clone(&val_conv);
66175         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
66176 }
66177
66178 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
66179         LDKHTLCDescriptor this_ptr_conv;
66180         this_ptr_conv.inner = untag_ptr(this_ptr);
66181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66183         this_ptr_conv.is_owned = false;
66184         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
66185         return ret_conv;
66186 }
66187
66188 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
66189         LDKHTLCDescriptor this_ptr_conv;
66190         this_ptr_conv.inner = untag_ptr(this_ptr);
66191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66193         this_ptr_conv.is_owned = false;
66194         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
66195 }
66196
66197 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
66198         LDKHTLCDescriptor this_ptr_conv;
66199         this_ptr_conv.inner = untag_ptr(this_ptr);
66200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66202         this_ptr_conv.is_owned = false;
66203         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66204         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
66205         return ret_arr;
66206 }
66207
66208 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
66209         LDKHTLCDescriptor this_ptr_conv;
66210         this_ptr_conv.inner = untag_ptr(this_ptr);
66211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66213         this_ptr_conv.is_owned = false;
66214         LDKPublicKey val_ref;
66215         CHECK(val->arr_len == 33);
66216         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
66217         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
66218 }
66219
66220 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
66221         LDKHTLCDescriptor this_ptr_conv;
66222         this_ptr_conv.inner = untag_ptr(this_ptr);
66223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66225         this_ptr_conv.is_owned = false;
66226         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
66227         uint64_t ret_ref = 0;
66228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66230         return ret_ref;
66231 }
66232
66233 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
66234         LDKHTLCDescriptor this_ptr_conv;
66235         this_ptr_conv.inner = untag_ptr(this_ptr);
66236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66238         this_ptr_conv.is_owned = false;
66239         LDKHTLCOutputInCommitment val_conv;
66240         val_conv.inner = untag_ptr(val);
66241         val_conv.is_owned = ptr_is_owned(val);
66242         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66243         val_conv = HTLCOutputInCommitment_clone(&val_conv);
66244         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
66245 }
66246
66247 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
66248         LDKHTLCDescriptor this_ptr_conv;
66249         this_ptr_conv.inner = untag_ptr(this_ptr);
66250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66252         this_ptr_conv.is_owned = false;
66253         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
66254         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
66255         uint64_t ret_ref = tag_ptr(ret_copy, true);
66256         return ret_ref;
66257 }
66258
66259 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
66260         LDKHTLCDescriptor this_ptr_conv;
66261         this_ptr_conv.inner = untag_ptr(this_ptr);
66262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66264         this_ptr_conv.is_owned = false;
66265         void* val_ptr = untag_ptr(val);
66266         CHECK_ACCESS(val_ptr);
66267         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
66268         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
66269         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
66270 }
66271
66272 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
66273         LDKHTLCDescriptor this_ptr_conv;
66274         this_ptr_conv.inner = untag_ptr(this_ptr);
66275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66277         this_ptr_conv.is_owned = false;
66278         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
66279         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
66280         return ret_arr;
66281 }
66282
66283 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
66284         LDKHTLCDescriptor this_ptr_conv;
66285         this_ptr_conv.inner = untag_ptr(this_ptr);
66286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66288         this_ptr_conv.is_owned = false;
66289         LDKECDSASignature val_ref;
66290         CHECK(val->arr_len == 64);
66291         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
66292         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
66293 }
66294
66295 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
66296         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
66297         uint64_t ret_ref = 0;
66298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66300         return ret_ref;
66301 }
66302 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
66303         LDKHTLCDescriptor arg_conv;
66304         arg_conv.inner = untag_ptr(arg);
66305         arg_conv.is_owned = ptr_is_owned(arg);
66306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66307         arg_conv.is_owned = false;
66308         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
66309         return ret_conv;
66310 }
66311
66312 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
66313         LDKHTLCDescriptor orig_conv;
66314         orig_conv.inner = untag_ptr(orig);
66315         orig_conv.is_owned = ptr_is_owned(orig);
66316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66317         orig_conv.is_owned = false;
66318         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
66319         uint64_t ret_ref = 0;
66320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66322         return ret_ref;
66323 }
66324
66325 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
66326         LDKHTLCDescriptor a_conv;
66327         a_conv.inner = untag_ptr(a);
66328         a_conv.is_owned = ptr_is_owned(a);
66329         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66330         a_conv.is_owned = false;
66331         LDKHTLCDescriptor b_conv;
66332         b_conv.inner = untag_ptr(b);
66333         b_conv.is_owned = ptr_is_owned(b);
66334         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66335         b_conv.is_owned = false;
66336         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
66337         return ret_conv;
66338 }
66339
66340 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
66341         LDKHTLCDescriptor obj_conv;
66342         obj_conv.inner = untag_ptr(obj);
66343         obj_conv.is_owned = ptr_is_owned(obj);
66344         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66345         obj_conv.is_owned = false;
66346         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
66347         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66348         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66349         CVec_u8Z_free(ret_var);
66350         return ret_arr;
66351 }
66352
66353 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
66354         LDKu8slice ser_ref;
66355         ser_ref.datalen = ser->arr_len;
66356         ser_ref.data = ser->elems;
66357         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
66358         *ret_conv = HTLCDescriptor_read(ser_ref);
66359         FREE(ser);
66360         return tag_ptr(ret_conv, true);
66361 }
66362
66363 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
66364         LDKHTLCDescriptor this_arg_conv;
66365         this_arg_conv.inner = untag_ptr(this_arg);
66366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66368         this_arg_conv.is_owned = false;
66369         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
66370         uint64_t ret_ref = 0;
66371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66373         return ret_ref;
66374 }
66375
66376 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
66377         LDKHTLCDescriptor this_arg_conv;
66378         this_arg_conv.inner = untag_ptr(this_arg);
66379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66381         this_arg_conv.is_owned = false;
66382         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66383         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
66384         return tag_ptr(ret_ref, true);
66385 }
66386
66387 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
66388         LDKHTLCDescriptor this_arg_conv;
66389         this_arg_conv.inner = untag_ptr(this_arg);
66390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66392         this_arg_conv.is_owned = false;
66393         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
66394         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
66395         return tag_ptr(ret_ref, true);
66396 }
66397
66398 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
66399         LDKHTLCDescriptor this_arg_conv;
66400         this_arg_conv.inner = untag_ptr(this_arg);
66401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66403         this_arg_conv.is_owned = false;
66404         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66405         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
66406         return tag_ptr(ret_ref, true);
66407 }
66408
66409 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
66410         LDKHTLCDescriptor this_arg_conv;
66411         this_arg_conv.inner = untag_ptr(this_arg);
66412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66414         this_arg_conv.is_owned = false;
66415         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
66416         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66417         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66418         CVec_u8Z_free(ret_var);
66419         return ret_arr;
66420 }
66421
66422 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) {
66423         LDKHTLCDescriptor this_arg_conv;
66424         this_arg_conv.inner = untag_ptr(this_arg);
66425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66427         this_arg_conv.is_owned = false;
66428         LDKECDSASignature signature_ref;
66429         CHECK(signature->arr_len == 64);
66430         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
66431         LDKu8slice witness_script_ref;
66432         witness_script_ref.datalen = witness_script->arr_len;
66433         witness_script_ref.data = witness_script->elems;
66434         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
66435         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66436         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66437         Witness_free(ret_var);
66438         FREE(witness_script);
66439         return ret_arr;
66440 }
66441
66442 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
66443         LDKHTLCDescriptor this_arg_conv;
66444         this_arg_conv.inner = untag_ptr(this_arg);
66445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66447         this_arg_conv.is_owned = false;
66448         void* signer_provider_ptr = untag_ptr(signer_provider);
66449         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
66450         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
66451         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66452         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
66453         return tag_ptr(ret_ret, true);
66454 }
66455
66456 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
66457         if (!ptr_is_owned(this_ptr)) return;
66458         void* this_ptr_ptr = untag_ptr(this_ptr);
66459         CHECK_ACCESS(this_ptr_ptr);
66460         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
66461         FREE(untag_ptr(this_ptr));
66462         BumpTransactionEvent_free(this_ptr_conv);
66463 }
66464
66465 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
66466         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66467         *ret_copy = BumpTransactionEvent_clone(arg);
66468         uint64_t ret_ref = tag_ptr(ret_copy, true);
66469         return ret_ref;
66470 }
66471 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
66472         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
66473         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
66474         return ret_conv;
66475 }
66476
66477 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
66478         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
66479         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66480         *ret_copy = BumpTransactionEvent_clone(orig_conv);
66481         uint64_t ret_ref = tag_ptr(ret_copy, true);
66482         return ret_ref;
66483 }
66484
66485 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) {
66486         LDKThirtyTwoBytes claim_id_ref;
66487         CHECK(claim_id->arr_len == 32);
66488         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
66489         LDKTransaction commitment_tx_ref;
66490         commitment_tx_ref.datalen = commitment_tx->arr_len;
66491         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
66492         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
66493         commitment_tx_ref.data_is_owned = true;
66494         LDKAnchorDescriptor anchor_descriptor_conv;
66495         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
66496         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
66497         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
66498         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
66499         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
66500         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
66501         if (pending_htlcs_constr.datalen > 0)
66502                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
66503         else
66504                 pending_htlcs_constr.data = NULL;
66505         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
66506         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
66507                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
66508                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
66509                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
66510                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
66511                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
66512                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
66513                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
66514         }
66515         FREE(pending_htlcs);
66516         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66517         *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);
66518         uint64_t ret_ref = tag_ptr(ret_copy, true);
66519         return ret_ref;
66520 }
66521
66522 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) {
66523         LDKThirtyTwoBytes claim_id_ref;
66524         CHECK(claim_id->arr_len == 32);
66525         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
66526         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
66527         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
66528         if (htlc_descriptors_constr.datalen > 0)
66529                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
66530         else
66531                 htlc_descriptors_constr.data = NULL;
66532         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
66533         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
66534                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
66535                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
66536                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
66537                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
66538                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
66539                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
66540                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
66541         }
66542         FREE(htlc_descriptors);
66543         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66544         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
66545         uint64_t ret_ref = tag_ptr(ret_copy, true);
66546         return ret_ref;
66547 }
66548
66549 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
66550         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
66551         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
66552         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
66553         return ret_conv;
66554 }
66555
66556 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
66557         LDKInput this_obj_conv;
66558         this_obj_conv.inner = untag_ptr(this_obj);
66559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66561         Input_free(this_obj_conv);
66562 }
66563
66564 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
66565         LDKInput this_ptr_conv;
66566         this_ptr_conv.inner = untag_ptr(this_ptr);
66567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66569         this_ptr_conv.is_owned = false;
66570         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
66571         uint64_t ret_ref = 0;
66572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66574         return ret_ref;
66575 }
66576
66577 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
66578         LDKInput this_ptr_conv;
66579         this_ptr_conv.inner = untag_ptr(this_ptr);
66580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66582         this_ptr_conv.is_owned = false;
66583         LDKOutPoint val_conv;
66584         val_conv.inner = untag_ptr(val);
66585         val_conv.is_owned = ptr_is_owned(val);
66586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66587         val_conv = OutPoint_clone(&val_conv);
66588         Input_set_outpoint(&this_ptr_conv, val_conv);
66589 }
66590
66591 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
66592         LDKInput this_ptr_conv;
66593         this_ptr_conv.inner = untag_ptr(this_ptr);
66594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66596         this_ptr_conv.is_owned = false;
66597         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66598         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
66599         return tag_ptr(ret_ref, true);
66600 }
66601
66602 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
66603         LDKInput this_ptr_conv;
66604         this_ptr_conv.inner = untag_ptr(this_ptr);
66605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66607         this_ptr_conv.is_owned = false;
66608         void* val_ptr = untag_ptr(val);
66609         CHECK_ACCESS(val_ptr);
66610         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66611         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66612         Input_set_previous_utxo(&this_ptr_conv, val_conv);
66613 }
66614
66615 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
66616         LDKInput this_ptr_conv;
66617         this_ptr_conv.inner = untag_ptr(this_ptr);
66618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66620         this_ptr_conv.is_owned = false;
66621         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
66622         return ret_conv;
66623 }
66624
66625 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
66626         LDKInput this_ptr_conv;
66627         this_ptr_conv.inner = untag_ptr(this_ptr);
66628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66630         this_ptr_conv.is_owned = false;
66631         Input_set_satisfaction_weight(&this_ptr_conv, val);
66632 }
66633
66634 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) {
66635         LDKOutPoint outpoint_arg_conv;
66636         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66637         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66638         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66639         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66640         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
66641         CHECK_ACCESS(previous_utxo_arg_ptr);
66642         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
66643         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
66644         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
66645         uint64_t ret_ref = 0;
66646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66648         return ret_ref;
66649 }
66650
66651 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
66652         LDKInput ret_var = Input_clone(arg);
66653         uint64_t ret_ref = 0;
66654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66656         return ret_ref;
66657 }
66658 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
66659         LDKInput arg_conv;
66660         arg_conv.inner = untag_ptr(arg);
66661         arg_conv.is_owned = ptr_is_owned(arg);
66662         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66663         arg_conv.is_owned = false;
66664         int64_t ret_conv = Input_clone_ptr(&arg_conv);
66665         return ret_conv;
66666 }
66667
66668 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
66669         LDKInput orig_conv;
66670         orig_conv.inner = untag_ptr(orig);
66671         orig_conv.is_owned = ptr_is_owned(orig);
66672         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66673         orig_conv.is_owned = false;
66674         LDKInput ret_var = Input_clone(&orig_conv);
66675         uint64_t ret_ref = 0;
66676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66678         return ret_ref;
66679 }
66680
66681 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
66682         LDKInput o_conv;
66683         o_conv.inner = untag_ptr(o);
66684         o_conv.is_owned = ptr_is_owned(o);
66685         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66686         o_conv.is_owned = false;
66687         int64_t ret_conv = Input_hash(&o_conv);
66688         return ret_conv;
66689 }
66690
66691 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
66692         LDKInput a_conv;
66693         a_conv.inner = untag_ptr(a);
66694         a_conv.is_owned = ptr_is_owned(a);
66695         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66696         a_conv.is_owned = false;
66697         LDKInput b_conv;
66698         b_conv.inner = untag_ptr(b);
66699         b_conv.is_owned = ptr_is_owned(b);
66700         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66701         b_conv.is_owned = false;
66702         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
66703         return ret_conv;
66704 }
66705
66706 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
66707         LDKUtxo this_obj_conv;
66708         this_obj_conv.inner = untag_ptr(this_obj);
66709         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66711         Utxo_free(this_obj_conv);
66712 }
66713
66714 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
66715         LDKUtxo this_ptr_conv;
66716         this_ptr_conv.inner = untag_ptr(this_ptr);
66717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66719         this_ptr_conv.is_owned = false;
66720         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
66721         uint64_t ret_ref = 0;
66722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66724         return ret_ref;
66725 }
66726
66727 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
66728         LDKUtxo this_ptr_conv;
66729         this_ptr_conv.inner = untag_ptr(this_ptr);
66730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66732         this_ptr_conv.is_owned = false;
66733         LDKOutPoint val_conv;
66734         val_conv.inner = untag_ptr(val);
66735         val_conv.is_owned = ptr_is_owned(val);
66736         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66737         val_conv = OutPoint_clone(&val_conv);
66738         Utxo_set_outpoint(&this_ptr_conv, val_conv);
66739 }
66740
66741 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
66742         LDKUtxo this_ptr_conv;
66743         this_ptr_conv.inner = untag_ptr(this_ptr);
66744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66746         this_ptr_conv.is_owned = false;
66747         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66748         *ret_ref = Utxo_get_output(&this_ptr_conv);
66749         return tag_ptr(ret_ref, true);
66750 }
66751
66752 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
66753         LDKUtxo this_ptr_conv;
66754         this_ptr_conv.inner = untag_ptr(this_ptr);
66755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66757         this_ptr_conv.is_owned = false;
66758         void* val_ptr = untag_ptr(val);
66759         CHECK_ACCESS(val_ptr);
66760         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66761         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66762         Utxo_set_output(&this_ptr_conv, val_conv);
66763 }
66764
66765 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
66766         LDKUtxo this_ptr_conv;
66767         this_ptr_conv.inner = untag_ptr(this_ptr);
66768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66770         this_ptr_conv.is_owned = false;
66771         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
66772         return ret_conv;
66773 }
66774
66775 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
66776         LDKUtxo this_ptr_conv;
66777         this_ptr_conv.inner = untag_ptr(this_ptr);
66778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66780         this_ptr_conv.is_owned = false;
66781         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
66782 }
66783
66784 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
66785         LDKOutPoint outpoint_arg_conv;
66786         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66787         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66788         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66789         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66790         void* output_arg_ptr = untag_ptr(output_arg);
66791         CHECK_ACCESS(output_arg_ptr);
66792         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
66793         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
66794         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
66795         uint64_t ret_ref = 0;
66796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66798         return ret_ref;
66799 }
66800
66801 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
66802         LDKUtxo ret_var = Utxo_clone(arg);
66803         uint64_t ret_ref = 0;
66804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66806         return ret_ref;
66807 }
66808 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
66809         LDKUtxo arg_conv;
66810         arg_conv.inner = untag_ptr(arg);
66811         arg_conv.is_owned = ptr_is_owned(arg);
66812         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66813         arg_conv.is_owned = false;
66814         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
66815         return ret_conv;
66816 }
66817
66818 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
66819         LDKUtxo orig_conv;
66820         orig_conv.inner = untag_ptr(orig);
66821         orig_conv.is_owned = ptr_is_owned(orig);
66822         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66823         orig_conv.is_owned = false;
66824         LDKUtxo ret_var = Utxo_clone(&orig_conv);
66825         uint64_t ret_ref = 0;
66826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66828         return ret_ref;
66829 }
66830
66831 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
66832         LDKUtxo o_conv;
66833         o_conv.inner = untag_ptr(o);
66834         o_conv.is_owned = ptr_is_owned(o);
66835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66836         o_conv.is_owned = false;
66837         int64_t ret_conv = Utxo_hash(&o_conv);
66838         return ret_conv;
66839 }
66840
66841 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
66842         LDKUtxo a_conv;
66843         a_conv.inner = untag_ptr(a);
66844         a_conv.is_owned = ptr_is_owned(a);
66845         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66846         a_conv.is_owned = false;
66847         LDKUtxo b_conv;
66848         b_conv.inner = untag_ptr(b);
66849         b_conv.is_owned = ptr_is_owned(b);
66850         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66851         b_conv.is_owned = false;
66852         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
66853         return ret_conv;
66854 }
66855
66856 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
66857         LDKOutPoint outpoint_conv;
66858         outpoint_conv.inner = untag_ptr(outpoint);
66859         outpoint_conv.is_owned = ptr_is_owned(outpoint);
66860         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
66861         outpoint_conv = OutPoint_clone(&outpoint_conv);
66862         uint8_t pubkey_hash_arr[20];
66863         CHECK(pubkey_hash->arr_len == 20);
66864         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
66865         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
66866         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
66867         uint64_t ret_ref = 0;
66868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66870         return ret_ref;
66871 }
66872
66873 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
66874         LDKCoinSelection this_obj_conv;
66875         this_obj_conv.inner = untag_ptr(this_obj);
66876         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66878         CoinSelection_free(this_obj_conv);
66879 }
66880
66881 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
66882         LDKCoinSelection this_ptr_conv;
66883         this_ptr_conv.inner = untag_ptr(this_ptr);
66884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66886         this_ptr_conv.is_owned = false;
66887         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
66888         uint64_tArray ret_arr = NULL;
66889         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
66890         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
66891         for (size_t g = 0; g < ret_var.datalen; g++) {
66892                 LDKUtxo ret_conv_6_var = ret_var.data[g];
66893                 uint64_t ret_conv_6_ref = 0;
66894                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
66895                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
66896                 ret_arr_ptr[g] = ret_conv_6_ref;
66897         }
66898         
66899         FREE(ret_var.data);
66900         return ret_arr;
66901 }
66902
66903 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
66904         LDKCoinSelection this_ptr_conv;
66905         this_ptr_conv.inner = untag_ptr(this_ptr);
66906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66908         this_ptr_conv.is_owned = false;
66909         LDKCVec_UtxoZ val_constr;
66910         val_constr.datalen = val->arr_len;
66911         if (val_constr.datalen > 0)
66912                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
66913         else
66914                 val_constr.data = NULL;
66915         uint64_t* val_vals = val->elems;
66916         for (size_t g = 0; g < val_constr.datalen; g++) {
66917                 uint64_t val_conv_6 = val_vals[g];
66918                 LDKUtxo val_conv_6_conv;
66919                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
66920                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
66921                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
66922                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
66923                 val_constr.data[g] = val_conv_6_conv;
66924         }
66925         FREE(val);
66926         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
66927 }
66928
66929 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
66930         LDKCoinSelection this_ptr_conv;
66931         this_ptr_conv.inner = untag_ptr(this_ptr);
66932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66934         this_ptr_conv.is_owned = false;
66935         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
66936         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
66937         uint64_t ret_ref = tag_ptr(ret_copy, true);
66938         return ret_ref;
66939 }
66940
66941 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
66942         LDKCoinSelection this_ptr_conv;
66943         this_ptr_conv.inner = untag_ptr(this_ptr);
66944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66946         this_ptr_conv.is_owned = false;
66947         void* val_ptr = untag_ptr(val);
66948         CHECK_ACCESS(val_ptr);
66949         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
66950         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
66951         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
66952 }
66953
66954 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
66955         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
66956         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
66957         if (confirmed_utxos_arg_constr.datalen > 0)
66958                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
66959         else
66960                 confirmed_utxos_arg_constr.data = NULL;
66961         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
66962         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
66963                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
66964                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
66965                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
66966                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
66967                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
66968                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
66969                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
66970         }
66971         FREE(confirmed_utxos_arg);
66972         void* change_output_arg_ptr = untag_ptr(change_output_arg);
66973         CHECK_ACCESS(change_output_arg_ptr);
66974         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
66975         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
66976         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
66977         uint64_t ret_ref = 0;
66978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66980         return ret_ref;
66981 }
66982
66983 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
66984         LDKCoinSelection ret_var = CoinSelection_clone(arg);
66985         uint64_t ret_ref = 0;
66986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66988         return ret_ref;
66989 }
66990 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
66991         LDKCoinSelection arg_conv;
66992         arg_conv.inner = untag_ptr(arg);
66993         arg_conv.is_owned = ptr_is_owned(arg);
66994         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66995         arg_conv.is_owned = false;
66996         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
66997         return ret_conv;
66998 }
66999
67000 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
67001         LDKCoinSelection orig_conv;
67002         orig_conv.inner = untag_ptr(orig);
67003         orig_conv.is_owned = ptr_is_owned(orig);
67004         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67005         orig_conv.is_owned = false;
67006         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
67007         uint64_t ret_ref = 0;
67008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67010         return ret_ref;
67011 }
67012
67013 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
67014         if (!ptr_is_owned(this_ptr)) return;
67015         void* this_ptr_ptr = untag_ptr(this_ptr);
67016         CHECK_ACCESS(this_ptr_ptr);
67017         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
67018         FREE(untag_ptr(this_ptr));
67019         CoinSelectionSource_free(this_ptr_conv);
67020 }
67021
67022 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
67023         if (!ptr_is_owned(this_ptr)) return;
67024         void* this_ptr_ptr = untag_ptr(this_ptr);
67025         CHECK_ACCESS(this_ptr_ptr);
67026         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
67027         FREE(untag_ptr(this_ptr));
67028         WalletSource_free(this_ptr_conv);
67029 }
67030
67031 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
67032         LDKWallet this_obj_conv;
67033         this_obj_conv.inner = untag_ptr(this_obj);
67034         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67036         Wallet_free(this_obj_conv);
67037 }
67038
67039 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
67040         void* source_ptr = untag_ptr(source);
67041         CHECK_ACCESS(source_ptr);
67042         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
67043         if (source_conv.free == LDKWalletSource_JCalls_free) {
67044                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67045                 LDKWalletSource_JCalls_cloned(&source_conv);
67046         }
67047         void* logger_ptr = untag_ptr(logger);
67048         CHECK_ACCESS(logger_ptr);
67049         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67050         if (logger_conv.free == LDKLogger_JCalls_free) {
67051                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67052                 LDKLogger_JCalls_cloned(&logger_conv);
67053         }
67054         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
67055         uint64_t ret_ref = 0;
67056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67058         return ret_ref;
67059 }
67060
67061 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
67062         LDKWallet this_arg_conv;
67063         this_arg_conv.inner = untag_ptr(this_arg);
67064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67066         this_arg_conv.is_owned = false;
67067         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
67068         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
67069         return tag_ptr(ret_ret, true);
67070 }
67071
67072 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
67073         LDKBumpTransactionEventHandler this_obj_conv;
67074         this_obj_conv.inner = untag_ptr(this_obj);
67075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67077         BumpTransactionEventHandler_free(this_obj_conv);
67078 }
67079
67080 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) {
67081         void* broadcaster_ptr = untag_ptr(broadcaster);
67082         CHECK_ACCESS(broadcaster_ptr);
67083         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
67084         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
67085                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67086                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
67087         }
67088         void* utxo_source_ptr = untag_ptr(utxo_source);
67089         CHECK_ACCESS(utxo_source_ptr);
67090         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
67091         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
67092                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67093                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
67094         }
67095         void* signer_provider_ptr = untag_ptr(signer_provider);
67096         CHECK_ACCESS(signer_provider_ptr);
67097         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
67098         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
67099                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67100                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
67101         }
67102         void* logger_ptr = untag_ptr(logger);
67103         CHECK_ACCESS(logger_ptr);
67104         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67105         if (logger_conv.free == LDKLogger_JCalls_free) {
67106                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67107                 LDKLogger_JCalls_cloned(&logger_conv);
67108         }
67109         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
67110         uint64_t ret_ref = 0;
67111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67113         return ret_ref;
67114 }
67115
67116 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
67117         LDKBumpTransactionEventHandler this_arg_conv;
67118         this_arg_conv.inner = untag_ptr(this_arg);
67119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67121         this_arg_conv.is_owned = false;
67122         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
67123         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
67124 }
67125
67126 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
67127         if (!ptr_is_owned(this_ptr)) return;
67128         void* this_ptr_ptr = untag_ptr(this_ptr);
67129         CHECK_ACCESS(this_ptr_ptr);
67130         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
67131         FREE(untag_ptr(this_ptr));
67132         GossipSync_free(this_ptr_conv);
67133 }
67134
67135 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
67136         LDKP2PGossipSync a_conv;
67137         a_conv.inner = untag_ptr(a);
67138         a_conv.is_owned = ptr_is_owned(a);
67139         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67140         a_conv.is_owned = false;
67141         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67142         *ret_copy = GossipSync_p2_p(&a_conv);
67143         uint64_t ret_ref = tag_ptr(ret_copy, true);
67144         return ret_ref;
67145 }
67146
67147 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
67148         LDKRapidGossipSync a_conv;
67149         a_conv.inner = untag_ptr(a);
67150         a_conv.is_owned = ptr_is_owned(a);
67151         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67152         a_conv.is_owned = false;
67153         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67154         *ret_copy = GossipSync_rapid(&a_conv);
67155         uint64_t ret_ref = tag_ptr(ret_copy, true);
67156         return ret_ref;
67157 }
67158
67159 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
67160         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67161         *ret_copy = GossipSync_none();
67162         uint64_t ret_ref = tag_ptr(ret_copy, true);
67163         return ret_ref;
67164 }
67165
67166 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
67167         LDKRapidGossipSync this_obj_conv;
67168         this_obj_conv.inner = untag_ptr(this_obj);
67169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67171         RapidGossipSync_free(this_obj_conv);
67172 }
67173
67174 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
67175         LDKNetworkGraph network_graph_conv;
67176         network_graph_conv.inner = untag_ptr(network_graph);
67177         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67178         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67179         network_graph_conv.is_owned = false;
67180         void* logger_ptr = untag_ptr(logger);
67181         CHECK_ACCESS(logger_ptr);
67182         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67183         if (logger_conv.free == LDKLogger_JCalls_free) {
67184                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67185                 LDKLogger_JCalls_cloned(&logger_conv);
67186         }
67187         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
67188         uint64_t ret_ref = 0;
67189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67191         return ret_ref;
67192 }
67193
67194 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) {
67195         LDKRapidGossipSync this_arg_conv;
67196         this_arg_conv.inner = untag_ptr(this_arg);
67197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67199         this_arg_conv.is_owned = false;
67200         LDKu8slice update_data_ref;
67201         update_data_ref.datalen = update_data->arr_len;
67202         update_data_ref.data = update_data->elems;
67203         void* current_time_unix_ptr = untag_ptr(current_time_unix);
67204         CHECK_ACCESS(current_time_unix_ptr);
67205         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
67206         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
67207         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
67208         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
67209         FREE(update_data);
67210         return tag_ptr(ret_conv, true);
67211 }
67212
67213 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
67214         LDKRapidGossipSync this_arg_conv;
67215         this_arg_conv.inner = untag_ptr(this_arg);
67216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67218         this_arg_conv.is_owned = false;
67219         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
67220         return ret_conv;
67221 }
67222
67223 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
67224         if (!ptr_is_owned(this_ptr)) return;
67225         void* this_ptr_ptr = untag_ptr(this_ptr);
67226         CHECK_ACCESS(this_ptr_ptr);
67227         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
67228         FREE(untag_ptr(this_ptr));
67229         GraphSyncError_free(this_ptr_conv);
67230 }
67231
67232 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
67233         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67234         *ret_copy = GraphSyncError_clone(arg);
67235         uint64_t ret_ref = tag_ptr(ret_copy, true);
67236         return ret_ref;
67237 }
67238 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
67239         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
67240         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
67241         return ret_conv;
67242 }
67243
67244 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
67245         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
67246         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67247         *ret_copy = GraphSyncError_clone(orig_conv);
67248         uint64_t ret_ref = tag_ptr(ret_copy, true);
67249         return ret_ref;
67250 }
67251
67252 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
67253         void* a_ptr = untag_ptr(a);
67254         CHECK_ACCESS(a_ptr);
67255         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
67256         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
67257         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67258         *ret_copy = GraphSyncError_decode_error(a_conv);
67259         uint64_t ret_ref = tag_ptr(ret_copy, true);
67260         return ret_ref;
67261 }
67262
67263 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
67264         LDKLightningError a_conv;
67265         a_conv.inner = untag_ptr(a);
67266         a_conv.is_owned = ptr_is_owned(a);
67267         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67268         a_conv = LightningError_clone(&a_conv);
67269         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67270         *ret_copy = GraphSyncError_lightning_error(a_conv);
67271         uint64_t ret_ref = tag_ptr(ret_copy, true);
67272         return ret_ref;
67273 }
67274
67275 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
67276         if (!ptr_is_owned(this_ptr)) return;
67277         void* this_ptr_ptr = untag_ptr(this_ptr);
67278         CHECK_ACCESS(this_ptr_ptr);
67279         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
67280         FREE(untag_ptr(this_ptr));
67281         Bolt11ParseError_free(this_ptr_conv);
67282 }
67283
67284 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
67285         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67286         *ret_copy = Bolt11ParseError_clone(arg);
67287         uint64_t ret_ref = tag_ptr(ret_copy, true);
67288         return ret_ref;
67289 }
67290 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
67291         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
67292         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
67293         return ret_conv;
67294 }
67295
67296 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
67297         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
67298         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67299         *ret_copy = Bolt11ParseError_clone(orig_conv);
67300         uint64_t ret_ref = tag_ptr(ret_copy, true);
67301         return ret_ref;
67302 }
67303
67304 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
67305         void* a_ptr = untag_ptr(a);
67306         CHECK_ACCESS(a_ptr);
67307         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
67308         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
67309         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67310         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
67311         uint64_t ret_ref = tag_ptr(ret_copy, true);
67312         return ret_ref;
67313 }
67314
67315 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
67316         
67317         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67318         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
67319         uint64_t ret_ref = tag_ptr(ret_copy, true);
67320         return ret_ref;
67321 }
67322
67323 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
67324         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
67325         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67326         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
67327         uint64_t ret_ref = tag_ptr(ret_copy, true);
67328         return ret_ref;
67329 }
67330
67331 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
67332         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67333         *ret_copy = Bolt11ParseError_bad_prefix();
67334         uint64_t ret_ref = tag_ptr(ret_copy, true);
67335         return ret_ref;
67336 }
67337
67338 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
67339         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67340         *ret_copy = Bolt11ParseError_unknown_currency();
67341         uint64_t ret_ref = tag_ptr(ret_copy, true);
67342         return ret_ref;
67343 }
67344
67345 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
67346         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67347         *ret_copy = Bolt11ParseError_unknown_si_prefix();
67348         uint64_t ret_ref = tag_ptr(ret_copy, true);
67349         return ret_ref;
67350 }
67351
67352 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
67353         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67354         *ret_copy = Bolt11ParseError_malformed_hrp();
67355         uint64_t ret_ref = tag_ptr(ret_copy, true);
67356         return ret_ref;
67357 }
67358
67359 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
67360         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67361         *ret_copy = Bolt11ParseError_too_short_data_part();
67362         uint64_t ret_ref = tag_ptr(ret_copy, true);
67363         return ret_ref;
67364 }
67365
67366 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
67367         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67368         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
67369         uint64_t ret_ref = tag_ptr(ret_copy, true);
67370         return ret_ref;
67371 }
67372
67373 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
67374         
67375         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67376         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
67377         uint64_t ret_ref = tag_ptr(ret_copy, true);
67378         return ret_ref;
67379 }
67380
67381 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
67382         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67383         *ret_copy = Bolt11ParseError_padding_error();
67384         uint64_t ret_ref = tag_ptr(ret_copy, true);
67385         return ret_ref;
67386 }
67387
67388 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
67389         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67390         *ret_copy = Bolt11ParseError_integer_overflow_error();
67391         uint64_t ret_ref = tag_ptr(ret_copy, true);
67392         return ret_ref;
67393 }
67394
67395 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
67396         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67397         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
67398         uint64_t ret_ref = tag_ptr(ret_copy, true);
67399         return ret_ref;
67400 }
67401
67402 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
67403         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67404         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
67405         uint64_t ret_ref = tag_ptr(ret_copy, true);
67406         return ret_ref;
67407 }
67408
67409 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
67410         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67411         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
67412         uint64_t ret_ref = tag_ptr(ret_copy, true);
67413         return ret_ref;
67414 }
67415
67416 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
67417         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67418         *ret_copy = Bolt11ParseError_invalid_recovery_id();
67419         uint64_t ret_ref = tag_ptr(ret_copy, true);
67420         return ret_ref;
67421 }
67422
67423 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
67424         LDKStr a_conv = str_ref_to_owned_c(a);
67425         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67426         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
67427         uint64_t ret_ref = tag_ptr(ret_copy, true);
67428         return ret_ref;
67429 }
67430
67431 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
67432         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67433         *ret_copy = Bolt11ParseError_skip();
67434         uint64_t ret_ref = tag_ptr(ret_copy, true);
67435         return ret_ref;
67436 }
67437
67438 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
67439         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
67440         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
67441         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
67442         return ret_conv;
67443 }
67444
67445 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
67446         if (!ptr_is_owned(this_ptr)) return;
67447         void* this_ptr_ptr = untag_ptr(this_ptr);
67448         CHECK_ACCESS(this_ptr_ptr);
67449         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
67450         FREE(untag_ptr(this_ptr));
67451         ParseOrSemanticError_free(this_ptr_conv);
67452 }
67453
67454 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
67455         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67456         *ret_copy = ParseOrSemanticError_clone(arg);
67457         uint64_t ret_ref = tag_ptr(ret_copy, true);
67458         return ret_ref;
67459 }
67460 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
67461         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
67462         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
67463         return ret_conv;
67464 }
67465
67466 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
67467         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
67468         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67469         *ret_copy = ParseOrSemanticError_clone(orig_conv);
67470         uint64_t ret_ref = tag_ptr(ret_copy, true);
67471         return ret_ref;
67472 }
67473
67474 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
67475         void* a_ptr = untag_ptr(a);
67476         CHECK_ACCESS(a_ptr);
67477         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
67478         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
67479         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67480         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
67481         uint64_t ret_ref = tag_ptr(ret_copy, true);
67482         return ret_ref;
67483 }
67484
67485 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
67486         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
67487         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67488         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
67489         uint64_t ret_ref = tag_ptr(ret_copy, true);
67490         return ret_ref;
67491 }
67492
67493 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
67494         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
67495         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
67496         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
67497         return ret_conv;
67498 }
67499
67500 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
67501         LDKBolt11Invoice this_obj_conv;
67502         this_obj_conv.inner = untag_ptr(this_obj);
67503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67505         Bolt11Invoice_free(this_obj_conv);
67506 }
67507
67508 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
67509         LDKBolt11Invoice a_conv;
67510         a_conv.inner = untag_ptr(a);
67511         a_conv.is_owned = ptr_is_owned(a);
67512         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67513         a_conv.is_owned = false;
67514         LDKBolt11Invoice b_conv;
67515         b_conv.inner = untag_ptr(b);
67516         b_conv.is_owned = ptr_is_owned(b);
67517         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67518         b_conv.is_owned = false;
67519         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
67520         return ret_conv;
67521 }
67522
67523 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
67524         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
67525         uint64_t ret_ref = 0;
67526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67528         return ret_ref;
67529 }
67530 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
67531         LDKBolt11Invoice arg_conv;
67532         arg_conv.inner = untag_ptr(arg);
67533         arg_conv.is_owned = ptr_is_owned(arg);
67534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67535         arg_conv.is_owned = false;
67536         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
67537         return ret_conv;
67538 }
67539
67540 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
67541         LDKBolt11Invoice orig_conv;
67542         orig_conv.inner = untag_ptr(orig);
67543         orig_conv.is_owned = ptr_is_owned(orig);
67544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67545         orig_conv.is_owned = false;
67546         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
67547         uint64_t ret_ref = 0;
67548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67550         return ret_ref;
67551 }
67552
67553 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
67554         LDKBolt11Invoice o_conv;
67555         o_conv.inner = untag_ptr(o);
67556         o_conv.is_owned = ptr_is_owned(o);
67557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67558         o_conv.is_owned = false;
67559         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
67560         return ret_conv;
67561 }
67562
67563 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
67564         LDKSignedRawBolt11Invoice this_obj_conv;
67565         this_obj_conv.inner = untag_ptr(this_obj);
67566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67568         SignedRawBolt11Invoice_free(this_obj_conv);
67569 }
67570
67571 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
67572         LDKSignedRawBolt11Invoice a_conv;
67573         a_conv.inner = untag_ptr(a);
67574         a_conv.is_owned = ptr_is_owned(a);
67575         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67576         a_conv.is_owned = false;
67577         LDKSignedRawBolt11Invoice b_conv;
67578         b_conv.inner = untag_ptr(b);
67579         b_conv.is_owned = ptr_is_owned(b);
67580         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67581         b_conv.is_owned = false;
67582         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
67583         return ret_conv;
67584 }
67585
67586 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
67587         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
67588         uint64_t ret_ref = 0;
67589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67591         return ret_ref;
67592 }
67593 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
67594         LDKSignedRawBolt11Invoice arg_conv;
67595         arg_conv.inner = untag_ptr(arg);
67596         arg_conv.is_owned = ptr_is_owned(arg);
67597         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67598         arg_conv.is_owned = false;
67599         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
67600         return ret_conv;
67601 }
67602
67603 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
67604         LDKSignedRawBolt11Invoice orig_conv;
67605         orig_conv.inner = untag_ptr(orig);
67606         orig_conv.is_owned = ptr_is_owned(orig);
67607         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67608         orig_conv.is_owned = false;
67609         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
67610         uint64_t ret_ref = 0;
67611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67613         return ret_ref;
67614 }
67615
67616 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
67617         LDKSignedRawBolt11Invoice o_conv;
67618         o_conv.inner = untag_ptr(o);
67619         o_conv.is_owned = ptr_is_owned(o);
67620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67621         o_conv.is_owned = false;
67622         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
67623         return ret_conv;
67624 }
67625
67626 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
67627         LDKRawBolt11Invoice this_obj_conv;
67628         this_obj_conv.inner = untag_ptr(this_obj);
67629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67631         RawBolt11Invoice_free(this_obj_conv);
67632 }
67633
67634 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
67635         LDKRawBolt11Invoice this_ptr_conv;
67636         this_ptr_conv.inner = untag_ptr(this_ptr);
67637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67639         this_ptr_conv.is_owned = false;
67640         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
67641         uint64_t ret_ref = 0;
67642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67644         return ret_ref;
67645 }
67646
67647 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
67648         LDKRawBolt11Invoice this_ptr_conv;
67649         this_ptr_conv.inner = untag_ptr(this_ptr);
67650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67652         this_ptr_conv.is_owned = false;
67653         LDKRawDataPart val_conv;
67654         val_conv.inner = untag_ptr(val);
67655         val_conv.is_owned = ptr_is_owned(val);
67656         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67657         val_conv = RawDataPart_clone(&val_conv);
67658         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
67659 }
67660
67661 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
67662         LDKRawBolt11Invoice a_conv;
67663         a_conv.inner = untag_ptr(a);
67664         a_conv.is_owned = ptr_is_owned(a);
67665         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67666         a_conv.is_owned = false;
67667         LDKRawBolt11Invoice b_conv;
67668         b_conv.inner = untag_ptr(b);
67669         b_conv.is_owned = ptr_is_owned(b);
67670         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67671         b_conv.is_owned = false;
67672         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
67673         return ret_conv;
67674 }
67675
67676 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
67677         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
67678         uint64_t ret_ref = 0;
67679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67681         return ret_ref;
67682 }
67683 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
67684         LDKRawBolt11Invoice arg_conv;
67685         arg_conv.inner = untag_ptr(arg);
67686         arg_conv.is_owned = ptr_is_owned(arg);
67687         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67688         arg_conv.is_owned = false;
67689         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
67690         return ret_conv;
67691 }
67692
67693 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
67694         LDKRawBolt11Invoice orig_conv;
67695         orig_conv.inner = untag_ptr(orig);
67696         orig_conv.is_owned = ptr_is_owned(orig);
67697         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67698         orig_conv.is_owned = false;
67699         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
67700         uint64_t ret_ref = 0;
67701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67703         return ret_ref;
67704 }
67705
67706 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
67707         LDKRawBolt11Invoice o_conv;
67708         o_conv.inner = untag_ptr(o);
67709         o_conv.is_owned = ptr_is_owned(o);
67710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67711         o_conv.is_owned = false;
67712         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
67713         return ret_conv;
67714 }
67715
67716 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
67717         LDKRawDataPart this_obj_conv;
67718         this_obj_conv.inner = untag_ptr(this_obj);
67719         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67721         RawDataPart_free(this_obj_conv);
67722 }
67723
67724 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
67725         LDKRawDataPart this_ptr_conv;
67726         this_ptr_conv.inner = untag_ptr(this_ptr);
67727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67729         this_ptr_conv.is_owned = false;
67730         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
67731         uint64_t ret_ref = 0;
67732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67734         return ret_ref;
67735 }
67736
67737 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
67738         LDKRawDataPart this_ptr_conv;
67739         this_ptr_conv.inner = untag_ptr(this_ptr);
67740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67742         this_ptr_conv.is_owned = false;
67743         LDKPositiveTimestamp val_conv;
67744         val_conv.inner = untag_ptr(val);
67745         val_conv.is_owned = ptr_is_owned(val);
67746         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67747         val_conv = PositiveTimestamp_clone(&val_conv);
67748         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
67749 }
67750
67751 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
67752         LDKRawDataPart a_conv;
67753         a_conv.inner = untag_ptr(a);
67754         a_conv.is_owned = ptr_is_owned(a);
67755         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67756         a_conv.is_owned = false;
67757         LDKRawDataPart b_conv;
67758         b_conv.inner = untag_ptr(b);
67759         b_conv.is_owned = ptr_is_owned(b);
67760         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67761         b_conv.is_owned = false;
67762         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
67763         return ret_conv;
67764 }
67765
67766 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
67767         LDKRawDataPart ret_var = RawDataPart_clone(arg);
67768         uint64_t ret_ref = 0;
67769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67771         return ret_ref;
67772 }
67773 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
67774         LDKRawDataPart arg_conv;
67775         arg_conv.inner = untag_ptr(arg);
67776         arg_conv.is_owned = ptr_is_owned(arg);
67777         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67778         arg_conv.is_owned = false;
67779         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
67780         return ret_conv;
67781 }
67782
67783 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
67784         LDKRawDataPart orig_conv;
67785         orig_conv.inner = untag_ptr(orig);
67786         orig_conv.is_owned = ptr_is_owned(orig);
67787         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67788         orig_conv.is_owned = false;
67789         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
67790         uint64_t ret_ref = 0;
67791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67793         return ret_ref;
67794 }
67795
67796 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
67797         LDKRawDataPart o_conv;
67798         o_conv.inner = untag_ptr(o);
67799         o_conv.is_owned = ptr_is_owned(o);
67800         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67801         o_conv.is_owned = false;
67802         int64_t ret_conv = RawDataPart_hash(&o_conv);
67803         return ret_conv;
67804 }
67805
67806 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
67807         LDKPositiveTimestamp this_obj_conv;
67808         this_obj_conv.inner = untag_ptr(this_obj);
67809         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67811         PositiveTimestamp_free(this_obj_conv);
67812 }
67813
67814 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
67815         LDKPositiveTimestamp a_conv;
67816         a_conv.inner = untag_ptr(a);
67817         a_conv.is_owned = ptr_is_owned(a);
67818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67819         a_conv.is_owned = false;
67820         LDKPositiveTimestamp b_conv;
67821         b_conv.inner = untag_ptr(b);
67822         b_conv.is_owned = ptr_is_owned(b);
67823         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67824         b_conv.is_owned = false;
67825         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
67826         return ret_conv;
67827 }
67828
67829 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
67830         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
67831         uint64_t ret_ref = 0;
67832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67834         return ret_ref;
67835 }
67836 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
67837         LDKPositiveTimestamp arg_conv;
67838         arg_conv.inner = untag_ptr(arg);
67839         arg_conv.is_owned = ptr_is_owned(arg);
67840         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67841         arg_conv.is_owned = false;
67842         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
67843         return ret_conv;
67844 }
67845
67846 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
67847         LDKPositiveTimestamp orig_conv;
67848         orig_conv.inner = untag_ptr(orig);
67849         orig_conv.is_owned = ptr_is_owned(orig);
67850         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67851         orig_conv.is_owned = false;
67852         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
67853         uint64_t ret_ref = 0;
67854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67856         return ret_ref;
67857 }
67858
67859 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
67860         LDKPositiveTimestamp o_conv;
67861         o_conv.inner = untag_ptr(o);
67862         o_conv.is_owned = ptr_is_owned(o);
67863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67864         o_conv.is_owned = false;
67865         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
67866         return ret_conv;
67867 }
67868
67869 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
67870         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
67871         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
67872         return ret_conv;
67873 }
67874
67875 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
67876         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
67877         return ret_conv;
67878 }
67879
67880 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
67881         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
67882         return ret_conv;
67883 }
67884
67885 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
67886         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
67887         return ret_conv;
67888 }
67889
67890 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
67891         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
67892         return ret_conv;
67893 }
67894
67895 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
67896         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
67897         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
67898         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
67899         return ret_conv;
67900 }
67901
67902 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
67903         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
67904         int64_t ret_conv = SiPrefix_hash(o_conv);
67905         return ret_conv;
67906 }
67907
67908 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
67909         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
67910         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
67911         return ret_conv;
67912 }
67913
67914 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
67915         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
67916         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
67917         return ret_conv;
67918 }
67919
67920 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
67921         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
67922         return ret_conv;
67923 }
67924
67925 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
67926         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
67927         return ret_conv;
67928 }
67929
67930 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
67931         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
67932         return ret_conv;
67933 }
67934
67935 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
67936         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
67937         return ret_conv;
67938 }
67939
67940 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
67941         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
67942         return ret_conv;
67943 }
67944
67945 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
67946         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
67947         int64_t ret_conv = Currency_hash(o_conv);
67948         return ret_conv;
67949 }
67950
67951 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
67952         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
67953         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
67954         jboolean ret_conv = Currency_eq(a_conv, b_conv);
67955         return ret_conv;
67956 }
67957
67958 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
67959         LDKSha256 this_obj_conv;
67960         this_obj_conv.inner = untag_ptr(this_obj);
67961         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67963         Sha256_free(this_obj_conv);
67964 }
67965
67966 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
67967         LDKSha256 ret_var = Sha256_clone(arg);
67968         uint64_t ret_ref = 0;
67969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67971         return ret_ref;
67972 }
67973 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
67974         LDKSha256 arg_conv;
67975         arg_conv.inner = untag_ptr(arg);
67976         arg_conv.is_owned = ptr_is_owned(arg);
67977         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67978         arg_conv.is_owned = false;
67979         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
67980         return ret_conv;
67981 }
67982
67983 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
67984         LDKSha256 orig_conv;
67985         orig_conv.inner = untag_ptr(orig);
67986         orig_conv.is_owned = ptr_is_owned(orig);
67987         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67988         orig_conv.is_owned = false;
67989         LDKSha256 ret_var = Sha256_clone(&orig_conv);
67990         uint64_t ret_ref = 0;
67991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67993         return ret_ref;
67994 }
67995
67996 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
67997         LDKSha256 o_conv;
67998         o_conv.inner = untag_ptr(o);
67999         o_conv.is_owned = ptr_is_owned(o);
68000         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68001         o_conv.is_owned = false;
68002         int64_t ret_conv = Sha256_hash(&o_conv);
68003         return ret_conv;
68004 }
68005
68006 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
68007         LDKSha256 a_conv;
68008         a_conv.inner = untag_ptr(a);
68009         a_conv.is_owned = ptr_is_owned(a);
68010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68011         a_conv.is_owned = false;
68012         LDKSha256 b_conv;
68013         b_conv.inner = untag_ptr(b);
68014         b_conv.is_owned = ptr_is_owned(b);
68015         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68016         b_conv.is_owned = false;
68017         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
68018         return ret_conv;
68019 }
68020
68021 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
68022         uint8_t bytes_arr[32];
68023         CHECK(bytes->arr_len == 32);
68024         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
68025         uint8_t (*bytes_ref)[32] = &bytes_arr;
68026         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
68027         uint64_t ret_ref = 0;
68028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68030         return ret_ref;
68031 }
68032
68033 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
68034         LDKDescription this_obj_conv;
68035         this_obj_conv.inner = untag_ptr(this_obj);
68036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68038         Description_free(this_obj_conv);
68039 }
68040
68041 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
68042         LDKDescription ret_var = Description_clone(arg);
68043         uint64_t ret_ref = 0;
68044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68046         return ret_ref;
68047 }
68048 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
68049         LDKDescription arg_conv;
68050         arg_conv.inner = untag_ptr(arg);
68051         arg_conv.is_owned = ptr_is_owned(arg);
68052         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68053         arg_conv.is_owned = false;
68054         int64_t ret_conv = Description_clone_ptr(&arg_conv);
68055         return ret_conv;
68056 }
68057
68058 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
68059         LDKDescription orig_conv;
68060         orig_conv.inner = untag_ptr(orig);
68061         orig_conv.is_owned = ptr_is_owned(orig);
68062         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68063         orig_conv.is_owned = false;
68064         LDKDescription ret_var = Description_clone(&orig_conv);
68065         uint64_t ret_ref = 0;
68066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68068         return ret_ref;
68069 }
68070
68071 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
68072         LDKDescription o_conv;
68073         o_conv.inner = untag_ptr(o);
68074         o_conv.is_owned = ptr_is_owned(o);
68075         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68076         o_conv.is_owned = false;
68077         int64_t ret_conv = Description_hash(&o_conv);
68078         return ret_conv;
68079 }
68080
68081 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
68082         LDKDescription a_conv;
68083         a_conv.inner = untag_ptr(a);
68084         a_conv.is_owned = ptr_is_owned(a);
68085         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68086         a_conv.is_owned = false;
68087         LDKDescription b_conv;
68088         b_conv.inner = untag_ptr(b);
68089         b_conv.is_owned = ptr_is_owned(b);
68090         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68091         b_conv.is_owned = false;
68092         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
68093         return ret_conv;
68094 }
68095
68096 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
68097         LDKPayeePubKey this_obj_conv;
68098         this_obj_conv.inner = untag_ptr(this_obj);
68099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68101         PayeePubKey_free(this_obj_conv);
68102 }
68103
68104 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
68105         LDKPayeePubKey this_ptr_conv;
68106         this_ptr_conv.inner = untag_ptr(this_ptr);
68107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68109         this_ptr_conv.is_owned = false;
68110         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68111         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
68112         return ret_arr;
68113 }
68114
68115 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
68116         LDKPayeePubKey this_ptr_conv;
68117         this_ptr_conv.inner = untag_ptr(this_ptr);
68118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68120         this_ptr_conv.is_owned = false;
68121         LDKPublicKey val_ref;
68122         CHECK(val->arr_len == 33);
68123         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68124         PayeePubKey_set_a(&this_ptr_conv, val_ref);
68125 }
68126
68127 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
68128         LDKPublicKey a_arg_ref;
68129         CHECK(a_arg->arr_len == 33);
68130         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
68131         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
68132         uint64_t ret_ref = 0;
68133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68135         return ret_ref;
68136 }
68137
68138 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
68139         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
68140         uint64_t ret_ref = 0;
68141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68143         return ret_ref;
68144 }
68145 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
68146         LDKPayeePubKey arg_conv;
68147         arg_conv.inner = untag_ptr(arg);
68148         arg_conv.is_owned = ptr_is_owned(arg);
68149         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68150         arg_conv.is_owned = false;
68151         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
68152         return ret_conv;
68153 }
68154
68155 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
68156         LDKPayeePubKey orig_conv;
68157         orig_conv.inner = untag_ptr(orig);
68158         orig_conv.is_owned = ptr_is_owned(orig);
68159         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68160         orig_conv.is_owned = false;
68161         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
68162         uint64_t ret_ref = 0;
68163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68165         return ret_ref;
68166 }
68167
68168 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
68169         LDKPayeePubKey o_conv;
68170         o_conv.inner = untag_ptr(o);
68171         o_conv.is_owned = ptr_is_owned(o);
68172         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68173         o_conv.is_owned = false;
68174         int64_t ret_conv = PayeePubKey_hash(&o_conv);
68175         return ret_conv;
68176 }
68177
68178 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
68179         LDKPayeePubKey a_conv;
68180         a_conv.inner = untag_ptr(a);
68181         a_conv.is_owned = ptr_is_owned(a);
68182         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68183         a_conv.is_owned = false;
68184         LDKPayeePubKey b_conv;
68185         b_conv.inner = untag_ptr(b);
68186         b_conv.is_owned = ptr_is_owned(b);
68187         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68188         b_conv.is_owned = false;
68189         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
68190         return ret_conv;
68191 }
68192
68193 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
68194         LDKExpiryTime this_obj_conv;
68195         this_obj_conv.inner = untag_ptr(this_obj);
68196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68198         ExpiryTime_free(this_obj_conv);
68199 }
68200
68201 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
68202         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
68203         uint64_t ret_ref = 0;
68204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68206         return ret_ref;
68207 }
68208 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
68209         LDKExpiryTime arg_conv;
68210         arg_conv.inner = untag_ptr(arg);
68211         arg_conv.is_owned = ptr_is_owned(arg);
68212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68213         arg_conv.is_owned = false;
68214         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
68215         return ret_conv;
68216 }
68217
68218 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
68219         LDKExpiryTime orig_conv;
68220         orig_conv.inner = untag_ptr(orig);
68221         orig_conv.is_owned = ptr_is_owned(orig);
68222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68223         orig_conv.is_owned = false;
68224         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
68225         uint64_t ret_ref = 0;
68226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68228         return ret_ref;
68229 }
68230
68231 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
68232         LDKExpiryTime o_conv;
68233         o_conv.inner = untag_ptr(o);
68234         o_conv.is_owned = ptr_is_owned(o);
68235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68236         o_conv.is_owned = false;
68237         int64_t ret_conv = ExpiryTime_hash(&o_conv);
68238         return ret_conv;
68239 }
68240
68241 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
68242         LDKExpiryTime a_conv;
68243         a_conv.inner = untag_ptr(a);
68244         a_conv.is_owned = ptr_is_owned(a);
68245         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68246         a_conv.is_owned = false;
68247         LDKExpiryTime b_conv;
68248         b_conv.inner = untag_ptr(b);
68249         b_conv.is_owned = ptr_is_owned(b);
68250         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68251         b_conv.is_owned = false;
68252         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
68253         return ret_conv;
68254 }
68255
68256 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
68257         LDKMinFinalCltvExpiryDelta this_obj_conv;
68258         this_obj_conv.inner = untag_ptr(this_obj);
68259         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68261         MinFinalCltvExpiryDelta_free(this_obj_conv);
68262 }
68263
68264 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
68265         LDKMinFinalCltvExpiryDelta this_ptr_conv;
68266         this_ptr_conv.inner = untag_ptr(this_ptr);
68267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68269         this_ptr_conv.is_owned = false;
68270         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
68271         return ret_conv;
68272 }
68273
68274 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
68275         LDKMinFinalCltvExpiryDelta this_ptr_conv;
68276         this_ptr_conv.inner = untag_ptr(this_ptr);
68277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68279         this_ptr_conv.is_owned = false;
68280         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
68281 }
68282
68283 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
68284         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
68285         uint64_t ret_ref = 0;
68286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68288         return ret_ref;
68289 }
68290
68291 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
68292         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
68293         uint64_t ret_ref = 0;
68294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68296         return ret_ref;
68297 }
68298 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
68299         LDKMinFinalCltvExpiryDelta arg_conv;
68300         arg_conv.inner = untag_ptr(arg);
68301         arg_conv.is_owned = ptr_is_owned(arg);
68302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68303         arg_conv.is_owned = false;
68304         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
68305         return ret_conv;
68306 }
68307
68308 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
68309         LDKMinFinalCltvExpiryDelta orig_conv;
68310         orig_conv.inner = untag_ptr(orig);
68311         orig_conv.is_owned = ptr_is_owned(orig);
68312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68313         orig_conv.is_owned = false;
68314         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
68315         uint64_t ret_ref = 0;
68316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68318         return ret_ref;
68319 }
68320
68321 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
68322         LDKMinFinalCltvExpiryDelta o_conv;
68323         o_conv.inner = untag_ptr(o);
68324         o_conv.is_owned = ptr_is_owned(o);
68325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68326         o_conv.is_owned = false;
68327         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
68328         return ret_conv;
68329 }
68330
68331 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
68332         LDKMinFinalCltvExpiryDelta a_conv;
68333         a_conv.inner = untag_ptr(a);
68334         a_conv.is_owned = ptr_is_owned(a);
68335         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68336         a_conv.is_owned = false;
68337         LDKMinFinalCltvExpiryDelta b_conv;
68338         b_conv.inner = untag_ptr(b);
68339         b_conv.is_owned = ptr_is_owned(b);
68340         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68341         b_conv.is_owned = false;
68342         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
68343         return ret_conv;
68344 }
68345
68346 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
68347         if (!ptr_is_owned(this_ptr)) return;
68348         void* this_ptr_ptr = untag_ptr(this_ptr);
68349         CHECK_ACCESS(this_ptr_ptr);
68350         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
68351         FREE(untag_ptr(this_ptr));
68352         Fallback_free(this_ptr_conv);
68353 }
68354
68355 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
68356         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68357         *ret_copy = Fallback_clone(arg);
68358         uint64_t ret_ref = tag_ptr(ret_copy, true);
68359         return ret_ref;
68360 }
68361 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
68362         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
68363         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
68364         return ret_conv;
68365 }
68366
68367 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
68368         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
68369         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68370         *ret_copy = Fallback_clone(orig_conv);
68371         uint64_t ret_ref = tag_ptr(ret_copy, true);
68372         return ret_ref;
68373 }
68374
68375 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
68376         
68377         LDKCVec_u8Z program_ref;
68378         program_ref.datalen = program->arr_len;
68379         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
68380         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
68381         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68382         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
68383         uint64_t ret_ref = tag_ptr(ret_copy, true);
68384         return ret_ref;
68385 }
68386
68387 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
68388         LDKTwentyBytes a_ref;
68389         CHECK(a->arr_len == 20);
68390         memcpy(a_ref.data, a->elems, 20); FREE(a);
68391         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68392         *ret_copy = Fallback_pub_key_hash(a_ref);
68393         uint64_t ret_ref = tag_ptr(ret_copy, true);
68394         return ret_ref;
68395 }
68396
68397 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
68398         LDKTwentyBytes a_ref;
68399         CHECK(a->arr_len == 20);
68400         memcpy(a_ref.data, a->elems, 20); FREE(a);
68401         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68402         *ret_copy = Fallback_script_hash(a_ref);
68403         uint64_t ret_ref = tag_ptr(ret_copy, true);
68404         return ret_ref;
68405 }
68406
68407 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
68408         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
68409         int64_t ret_conv = Fallback_hash(o_conv);
68410         return ret_conv;
68411 }
68412
68413 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
68414         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
68415         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
68416         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
68417         return ret_conv;
68418 }
68419
68420 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
68421         LDKBolt11InvoiceSignature this_obj_conv;
68422         this_obj_conv.inner = untag_ptr(this_obj);
68423         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68425         Bolt11InvoiceSignature_free(this_obj_conv);
68426 }
68427
68428 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
68429         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
68430         uint64_t ret_ref = 0;
68431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68433         return ret_ref;
68434 }
68435 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
68436         LDKBolt11InvoiceSignature arg_conv;
68437         arg_conv.inner = untag_ptr(arg);
68438         arg_conv.is_owned = ptr_is_owned(arg);
68439         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68440         arg_conv.is_owned = false;
68441         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
68442         return ret_conv;
68443 }
68444
68445 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
68446         LDKBolt11InvoiceSignature orig_conv;
68447         orig_conv.inner = untag_ptr(orig);
68448         orig_conv.is_owned = ptr_is_owned(orig);
68449         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68450         orig_conv.is_owned = false;
68451         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
68452         uint64_t ret_ref = 0;
68453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68455         return ret_ref;
68456 }
68457
68458 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
68459         LDKBolt11InvoiceSignature o_conv;
68460         o_conv.inner = untag_ptr(o);
68461         o_conv.is_owned = ptr_is_owned(o);
68462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68463         o_conv.is_owned = false;
68464         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
68465         return ret_conv;
68466 }
68467
68468 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
68469         LDKBolt11InvoiceSignature a_conv;
68470         a_conv.inner = untag_ptr(a);
68471         a_conv.is_owned = ptr_is_owned(a);
68472         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68473         a_conv.is_owned = false;
68474         LDKBolt11InvoiceSignature b_conv;
68475         b_conv.inner = untag_ptr(b);
68476         b_conv.is_owned = ptr_is_owned(b);
68477         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68478         b_conv.is_owned = false;
68479         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
68480         return ret_conv;
68481 }
68482
68483 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
68484         LDKPrivateRoute this_obj_conv;
68485         this_obj_conv.inner = untag_ptr(this_obj);
68486         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68488         PrivateRoute_free(this_obj_conv);
68489 }
68490
68491 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
68492         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
68493         uint64_t ret_ref = 0;
68494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68496         return ret_ref;
68497 }
68498 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
68499         LDKPrivateRoute arg_conv;
68500         arg_conv.inner = untag_ptr(arg);
68501         arg_conv.is_owned = ptr_is_owned(arg);
68502         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68503         arg_conv.is_owned = false;
68504         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
68505         return ret_conv;
68506 }
68507
68508 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
68509         LDKPrivateRoute orig_conv;
68510         orig_conv.inner = untag_ptr(orig);
68511         orig_conv.is_owned = ptr_is_owned(orig);
68512         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68513         orig_conv.is_owned = false;
68514         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
68515         uint64_t ret_ref = 0;
68516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68518         return ret_ref;
68519 }
68520
68521 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
68522         LDKPrivateRoute o_conv;
68523         o_conv.inner = untag_ptr(o);
68524         o_conv.is_owned = ptr_is_owned(o);
68525         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68526         o_conv.is_owned = false;
68527         int64_t ret_conv = PrivateRoute_hash(&o_conv);
68528         return ret_conv;
68529 }
68530
68531 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
68532         LDKPrivateRoute a_conv;
68533         a_conv.inner = untag_ptr(a);
68534         a_conv.is_owned = ptr_is_owned(a);
68535         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68536         a_conv.is_owned = false;
68537         LDKPrivateRoute b_conv;
68538         b_conv.inner = untag_ptr(b);
68539         b_conv.is_owned = ptr_is_owned(b);
68540         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68541         b_conv.is_owned = false;
68542         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
68543         return ret_conv;
68544 }
68545
68546 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
68547         LDKSignedRawBolt11Invoice this_arg_conv;
68548         this_arg_conv.inner = untag_ptr(this_arg);
68549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68551         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
68552         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
68553         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
68554         return tag_ptr(ret_conv, true);
68555 }
68556
68557 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
68558         LDKSignedRawBolt11Invoice this_arg_conv;
68559         this_arg_conv.inner = untag_ptr(this_arg);
68560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68562         this_arg_conv.is_owned = false;
68563         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
68564         uint64_t ret_ref = 0;
68565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68567         return ret_ref;
68568 }
68569
68570 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
68571         LDKSignedRawBolt11Invoice this_arg_conv;
68572         this_arg_conv.inner = untag_ptr(this_arg);
68573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68575         this_arg_conv.is_owned = false;
68576         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68577         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
68578         return ret_arr;
68579 }
68580
68581 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
68582         LDKSignedRawBolt11Invoice this_arg_conv;
68583         this_arg_conv.inner = untag_ptr(this_arg);
68584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68586         this_arg_conv.is_owned = false;
68587         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
68588         uint64_t ret_ref = 0;
68589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68591         return ret_ref;
68592 }
68593
68594 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
68595         LDKSignedRawBolt11Invoice this_arg_conv;
68596         this_arg_conv.inner = untag_ptr(this_arg);
68597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68599         this_arg_conv.is_owned = false;
68600         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
68601         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
68602         return tag_ptr(ret_conv, true);
68603 }
68604
68605 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
68606         LDKSignedRawBolt11Invoice this_arg_conv;
68607         this_arg_conv.inner = untag_ptr(this_arg);
68608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68610         this_arg_conv.is_owned = false;
68611         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
68612         return ret_conv;
68613 }
68614
68615 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
68616         LDKRawBolt11Invoice this_arg_conv;
68617         this_arg_conv.inner = untag_ptr(this_arg);
68618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68620         this_arg_conv.is_owned = false;
68621         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68622         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
68623         return ret_arr;
68624 }
68625
68626 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
68627         LDKRawBolt11Invoice this_arg_conv;
68628         this_arg_conv.inner = untag_ptr(this_arg);
68629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68631         this_arg_conv.is_owned = false;
68632         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
68633         uint64_t ret_ref = 0;
68634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68636         return ret_ref;
68637 }
68638
68639 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
68640         LDKRawBolt11Invoice this_arg_conv;
68641         this_arg_conv.inner = untag_ptr(this_arg);
68642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68644         this_arg_conv.is_owned = false;
68645         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
68646         uint64_t ret_ref = 0;
68647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68649         return ret_ref;
68650 }
68651
68652 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
68653         LDKRawBolt11Invoice this_arg_conv;
68654         this_arg_conv.inner = untag_ptr(this_arg);
68655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68657         this_arg_conv.is_owned = false;
68658         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
68659         uint64_t ret_ref = 0;
68660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68662         return ret_ref;
68663 }
68664
68665 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
68666         LDKRawBolt11Invoice this_arg_conv;
68667         this_arg_conv.inner = untag_ptr(this_arg);
68668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68670         this_arg_conv.is_owned = false;
68671         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
68672         uint64_t ret_ref = 0;
68673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68675         return ret_ref;
68676 }
68677
68678 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
68679         LDKRawBolt11Invoice this_arg_conv;
68680         this_arg_conv.inner = untag_ptr(this_arg);
68681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68683         this_arg_conv.is_owned = false;
68684         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
68685         uint64_t ret_ref = 0;
68686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68688         return ret_ref;
68689 }
68690
68691 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
68692         LDKRawBolt11Invoice this_arg_conv;
68693         this_arg_conv.inner = untag_ptr(this_arg);
68694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68696         this_arg_conv.is_owned = false;
68697         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
68698         uint64_t ret_ref = 0;
68699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68701         return ret_ref;
68702 }
68703
68704 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
68705         LDKRawBolt11Invoice this_arg_conv;
68706         this_arg_conv.inner = untag_ptr(this_arg);
68707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68709         this_arg_conv.is_owned = false;
68710         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
68711         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
68712         uint64_t ret_ref = tag_ptr(ret_copy, true);
68713         return ret_ref;
68714 }
68715
68716 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
68717         LDKRawBolt11Invoice this_arg_conv;
68718         this_arg_conv.inner = untag_ptr(this_arg);
68719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68721         this_arg_conv.is_owned = false;
68722         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68723         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
68724         uint64_t ret_ref = tag_ptr(ret_copy, true);
68725         return ret_ref;
68726 }
68727
68728 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
68729         LDKRawBolt11Invoice this_arg_conv;
68730         this_arg_conv.inner = untag_ptr(this_arg);
68731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68733         this_arg_conv.is_owned = false;
68734         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
68735         uint64_t ret_ref = 0;
68736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68738         return ret_ref;
68739 }
68740
68741 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
68742         LDKRawBolt11Invoice this_arg_conv;
68743         this_arg_conv.inner = untag_ptr(this_arg);
68744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68746         this_arg_conv.is_owned = false;
68747         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
68748         uint64_tArray ret_arr = NULL;
68749         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
68750         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
68751         for (size_t o = 0; o < ret_var.datalen; o++) {
68752                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
68753                 uint64_t ret_conv_14_ref = 0;
68754                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
68755                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
68756                 ret_arr_ptr[o] = ret_conv_14_ref;
68757         }
68758         
68759         FREE(ret_var.data);
68760         return ret_arr;
68761 }
68762
68763 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
68764         LDKRawBolt11Invoice this_arg_conv;
68765         this_arg_conv.inner = untag_ptr(this_arg);
68766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68768         this_arg_conv.is_owned = false;
68769         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68770         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
68771         uint64_t ret_ref = tag_ptr(ret_copy, true);
68772         return ret_ref;
68773 }
68774
68775 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
68776         LDKRawBolt11Invoice this_arg_conv;
68777         this_arg_conv.inner = untag_ptr(this_arg);
68778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68780         this_arg_conv.is_owned = false;
68781         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
68782         return ret_conv;
68783 }
68784
68785 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
68786         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68787         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
68788         return tag_ptr(ret_conv, true);
68789 }
68790
68791 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
68792         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68793         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
68794         return tag_ptr(ret_conv, true);
68795 }
68796
68797 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
68798         LDKPositiveTimestamp this_arg_conv;
68799         this_arg_conv.inner = untag_ptr(this_arg);
68800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68802         this_arg_conv.is_owned = false;
68803         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
68804         return ret_conv;
68805 }
68806
68807 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
68808         LDKPositiveTimestamp this_arg_conv;
68809         this_arg_conv.inner = untag_ptr(this_arg);
68810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68812         this_arg_conv.is_owned = false;
68813         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
68814         return ret_conv;
68815 }
68816
68817 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
68818         LDKBolt11Invoice this_arg_conv;
68819         this_arg_conv.inner = untag_ptr(this_arg);
68820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68822         this_arg_conv.is_owned = false;
68823         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68824         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
68825         return ret_arr;
68826 }
68827
68828 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
68829         LDKBolt11Invoice this_arg_conv;
68830         this_arg_conv.inner = untag_ptr(this_arg);
68831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68833         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
68834         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
68835         uint64_t ret_ref = 0;
68836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68838         return ret_ref;
68839 }
68840
68841 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
68842         LDKBolt11Invoice this_arg_conv;
68843         this_arg_conv.inner = untag_ptr(this_arg);
68844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68846         this_arg_conv.is_owned = false;
68847         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
68848         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
68849         return tag_ptr(ret_conv, true);
68850 }
68851
68852 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
68853         LDKSignedRawBolt11Invoice signed_invoice_conv;
68854         signed_invoice_conv.inner = untag_ptr(signed_invoice);
68855         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
68856         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
68857         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
68858         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
68859         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
68860         return tag_ptr(ret_conv, true);
68861 }
68862
68863 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
68864         LDKBolt11Invoice this_arg_conv;
68865         this_arg_conv.inner = untag_ptr(this_arg);
68866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68868         this_arg_conv.is_owned = false;
68869         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
68870         return ret_conv;
68871 }
68872
68873 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
68874         LDKBolt11Invoice this_arg_conv;
68875         this_arg_conv.inner = untag_ptr(this_arg);
68876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68878         this_arg_conv.is_owned = false;
68879         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68880         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
68881         return ret_arr;
68882 }
68883
68884 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
68885         LDKBolt11Invoice this_arg_conv;
68886         this_arg_conv.inner = untag_ptr(this_arg);
68887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68889         this_arg_conv.is_owned = false;
68890         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68891         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
68892         return ret_arr;
68893 }
68894
68895 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
68896         LDKBolt11Invoice this_arg_conv;
68897         this_arg_conv.inner = untag_ptr(this_arg);
68898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68900         this_arg_conv.is_owned = false;
68901         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68902         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
68903         return ret_arr;
68904 }
68905
68906 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
68907         LDKBolt11Invoice this_arg_conv;
68908         this_arg_conv.inner = untag_ptr(this_arg);
68909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68911         this_arg_conv.is_owned = false;
68912         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68913         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
68914         uint64_t ret_ref = tag_ptr(ret_copy, true);
68915         return ret_ref;
68916 }
68917
68918 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
68919         LDKBolt11Invoice this_arg_conv;
68920         this_arg_conv.inner = untag_ptr(this_arg);
68921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68923         this_arg_conv.is_owned = false;
68924         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
68925         uint64_t ret_ref = 0;
68926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68928         return ret_ref;
68929 }
68930
68931 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
68932         LDKBolt11Invoice this_arg_conv;
68933         this_arg_conv.inner = untag_ptr(this_arg);
68934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68936         this_arg_conv.is_owned = false;
68937         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68938         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
68939         return ret_arr;
68940 }
68941
68942 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
68943         LDKBolt11Invoice this_arg_conv;
68944         this_arg_conv.inner = untag_ptr(this_arg);
68945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68947         this_arg_conv.is_owned = false;
68948         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68949         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
68950         uint64_t ret_ref = tag_ptr(ret_copy, true);
68951         return ret_ref;
68952 }
68953
68954 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
68955         LDKBolt11Invoice this_arg_conv;
68956         this_arg_conv.inner = untag_ptr(this_arg);
68957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68959         this_arg_conv.is_owned = false;
68960         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
68961         return ret_conv;
68962 }
68963
68964 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
68965         LDKBolt11Invoice this_arg_conv;
68966         this_arg_conv.inner = untag_ptr(this_arg);
68967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68969         this_arg_conv.is_owned = false;
68970         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
68971         return ret_conv;
68972 }
68973
68974 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
68975         LDKBolt11Invoice this_arg_conv;
68976         this_arg_conv.inner = untag_ptr(this_arg);
68977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68979         this_arg_conv.is_owned = false;
68980         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
68981         return ret_conv;
68982 }
68983
68984 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
68985         LDKBolt11Invoice this_arg_conv;
68986         this_arg_conv.inner = untag_ptr(this_arg);
68987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68989         this_arg_conv.is_owned = false;
68990         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
68991         return ret_conv;
68992 }
68993
68994 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
68995         LDKBolt11Invoice this_arg_conv;
68996         this_arg_conv.inner = untag_ptr(this_arg);
68997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68999         this_arg_conv.is_owned = false;
69000         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
69001         ptrArray ret_arr = NULL;
69002         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
69003         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
69004         for (size_t i = 0; i < ret_var.datalen; i++) {
69005                 LDKStr ret_conv_8_str = ret_var.data[i];
69006                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
69007                 Str_free(ret_conv_8_str);
69008                 ret_arr_ptr[i] = ret_conv_8_conv;
69009         }
69010         
69011         FREE(ret_var.data);
69012         return ret_arr;
69013 }
69014
69015 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
69016         LDKBolt11Invoice this_arg_conv;
69017         this_arg_conv.inner = untag_ptr(this_arg);
69018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69020         this_arg_conv.is_owned = false;
69021         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
69022         uint64_tArray ret_arr = NULL;
69023         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69024         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69025         for (size_t o = 0; o < ret_var.datalen; o++) {
69026                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
69027                 uint64_t ret_conv_14_ref = 0;
69028                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
69029                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
69030                 ret_arr_ptr[o] = ret_conv_14_ref;
69031         }
69032         
69033         FREE(ret_var.data);
69034         return ret_arr;
69035 }
69036
69037 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
69038         LDKBolt11Invoice this_arg_conv;
69039         this_arg_conv.inner = untag_ptr(this_arg);
69040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69042         this_arg_conv.is_owned = false;
69043         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
69044         uint64_tArray ret_arr = NULL;
69045         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69046         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69047         for (size_t l = 0; l < ret_var.datalen; l++) {
69048                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
69049                 uint64_t ret_conv_11_ref = 0;
69050                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
69051                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
69052                 ret_arr_ptr[l] = ret_conv_11_ref;
69053         }
69054         
69055         FREE(ret_var.data);
69056         return ret_arr;
69057 }
69058
69059 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
69060         LDKBolt11Invoice this_arg_conv;
69061         this_arg_conv.inner = untag_ptr(this_arg);
69062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69064         this_arg_conv.is_owned = false;
69065         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
69066         return ret_conv;
69067 }
69068
69069 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
69070         LDKBolt11Invoice this_arg_conv;
69071         this_arg_conv.inner = untag_ptr(this_arg);
69072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69074         this_arg_conv.is_owned = false;
69075         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69076         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
69077         uint64_t ret_ref = tag_ptr(ret_copy, true);
69078         return ret_ref;
69079 }
69080
69081 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
69082         LDKStr description_conv = str_ref_to_owned_c(description);
69083         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
69084         *ret_conv = Description_new(description_conv);
69085         return tag_ptr(ret_conv, true);
69086 }
69087
69088 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
69089         LDKDescription this_arg_conv;
69090         this_arg_conv.inner = untag_ptr(this_arg);
69091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69093         this_arg_conv = Description_clone(&this_arg_conv);
69094         LDKStr ret_str = Description_into_inner(this_arg_conv);
69095         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69096         Str_free(ret_str);
69097         return ret_conv;
69098 }
69099
69100 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
69101         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
69102         uint64_t ret_ref = 0;
69103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69105         return ret_ref;
69106 }
69107
69108 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
69109         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
69110         uint64_t ret_ref = 0;
69111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69113         return ret_ref;
69114 }
69115
69116 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
69117         LDKExpiryTime this_arg_conv;
69118         this_arg_conv.inner = untag_ptr(this_arg);
69119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69121         this_arg_conv.is_owned = false;
69122         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
69123         return ret_conv;
69124 }
69125
69126 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
69127         LDKExpiryTime this_arg_conv;
69128         this_arg_conv.inner = untag_ptr(this_arg);
69129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69131         this_arg_conv.is_owned = false;
69132         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
69133         return ret_conv;
69134 }
69135
69136 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
69137         LDKRouteHint hops_conv;
69138         hops_conv.inner = untag_ptr(hops);
69139         hops_conv.is_owned = ptr_is_owned(hops);
69140         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
69141         hops_conv = RouteHint_clone(&hops_conv);
69142         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
69143         *ret_conv = PrivateRoute_new(hops_conv);
69144         return tag_ptr(ret_conv, true);
69145 }
69146
69147 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
69148         LDKPrivateRoute this_arg_conv;
69149         this_arg_conv.inner = untag_ptr(this_arg);
69150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69152         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
69153         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
69154         uint64_t ret_ref = 0;
69155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69157         return ret_ref;
69158 }
69159
69160 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
69161         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
69162         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
69163         return ret_conv;
69164 }
69165
69166 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
69167         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
69168         return ret_conv;
69169 }
69170
69171 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
69172         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
69173         return ret_conv;
69174 }
69175
69176 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
69177         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
69178         return ret_conv;
69179 }
69180
69181 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
69182         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
69183         return ret_conv;
69184 }
69185
69186 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
69187         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
69188         return ret_conv;
69189 }
69190
69191 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
69192         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
69193         return ret_conv;
69194 }
69195
69196 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
69197         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
69198         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
69199         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
69200         return ret_conv;
69201 }
69202
69203 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
69204         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
69205         LDKStr ret_str = CreationError_to_str(o_conv);
69206         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69207         Str_free(ret_str);
69208         return ret_conv;
69209 }
69210
69211 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
69212         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
69213         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
69214         return ret_conv;
69215 }
69216
69217 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
69218         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
69219         return ret_conv;
69220 }
69221
69222 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
69223         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
69224         return ret_conv;
69225 }
69226
69227 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
69228         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
69229         return ret_conv;
69230 }
69231
69232 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
69233         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
69234         return ret_conv;
69235 }
69236
69237 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
69238         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
69239         return ret_conv;
69240 }
69241
69242 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
69243         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
69244         return ret_conv;
69245 }
69246
69247 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
69248         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
69249         return ret_conv;
69250 }
69251
69252 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
69253         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
69254         return ret_conv;
69255 }
69256
69257 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
69258         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
69259         return ret_conv;
69260 }
69261
69262 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
69263         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
69264         return ret_conv;
69265 }
69266
69267 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
69268         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
69269         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
69270         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
69271         return ret_conv;
69272 }
69273
69274 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
69275         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
69276         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
69277         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69278         Str_free(ret_str);
69279         return ret_conv;
69280 }
69281
69282 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
69283         if (!ptr_is_owned(this_ptr)) return;
69284         void* this_ptr_ptr = untag_ptr(this_ptr);
69285         CHECK_ACCESS(this_ptr_ptr);
69286         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
69287         FREE(untag_ptr(this_ptr));
69288         SignOrCreationError_free(this_ptr_conv);
69289 }
69290
69291 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
69292         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69293         *ret_copy = SignOrCreationError_clone(arg);
69294         uint64_t ret_ref = tag_ptr(ret_copy, true);
69295         return ret_ref;
69296 }
69297 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
69298         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
69299         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
69300         return ret_conv;
69301 }
69302
69303 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
69304         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
69305         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69306         *ret_copy = SignOrCreationError_clone(orig_conv);
69307         uint64_t ret_ref = tag_ptr(ret_copy, true);
69308         return ret_ref;
69309 }
69310
69311 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
69312         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69313         *ret_copy = SignOrCreationError_sign_error();
69314         uint64_t ret_ref = tag_ptr(ret_copy, true);
69315         return ret_ref;
69316 }
69317
69318 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
69319         LDKCreationError a_conv = LDKCreationError_from_js(a);
69320         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69321         *ret_copy = SignOrCreationError_creation_error(a_conv);
69322         uint64_t ret_ref = tag_ptr(ret_copy, true);
69323         return ret_ref;
69324 }
69325
69326 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
69327         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
69328         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
69329         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
69330         return ret_conv;
69331 }
69332
69333 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
69334         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
69335         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
69336         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69337         Str_free(ret_str);
69338         return ret_conv;
69339 }
69340
69341 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
69342         LDKBolt11Invoice invoice_conv;
69343         invoice_conv.inner = untag_ptr(invoice);
69344         invoice_conv.is_owned = ptr_is_owned(invoice);
69345         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69346         invoice_conv.is_owned = false;
69347         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69348         CHECK_ACCESS(retry_strategy_ptr);
69349         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69350         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69351         LDKChannelManager channelmanager_conv;
69352         channelmanager_conv.inner = untag_ptr(channelmanager);
69353         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69354         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69355         channelmanager_conv.is_owned = false;
69356         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
69357         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
69358         return tag_ptr(ret_conv, true);
69359 }
69360
69361 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) {
69362         LDKBolt11Invoice invoice_conv;
69363         invoice_conv.inner = untag_ptr(invoice);
69364         invoice_conv.is_owned = ptr_is_owned(invoice);
69365         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69366         invoice_conv.is_owned = false;
69367         LDKThirtyTwoBytes payment_id_ref;
69368         CHECK(payment_id->arr_len == 32);
69369         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
69370         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69371         CHECK_ACCESS(retry_strategy_ptr);
69372         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69373         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69374         LDKChannelManager channelmanager_conv;
69375         channelmanager_conv.inner = untag_ptr(channelmanager);
69376         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69377         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69378         channelmanager_conv.is_owned = false;
69379         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
69380         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
69381         return tag_ptr(ret_conv, true);
69382 }
69383
69384 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) {
69385         LDKBolt11Invoice invoice_conv;
69386         invoice_conv.inner = untag_ptr(invoice);
69387         invoice_conv.is_owned = ptr_is_owned(invoice);
69388         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69389         invoice_conv.is_owned = false;
69390         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69391         CHECK_ACCESS(retry_strategy_ptr);
69392         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69393         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69394         LDKChannelManager channelmanager_conv;
69395         channelmanager_conv.inner = untag_ptr(channelmanager);
69396         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69397         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69398         channelmanager_conv.is_owned = false;
69399         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
69400         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
69401         return tag_ptr(ret_conv, true);
69402 }
69403
69404 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) {
69405         LDKBolt11Invoice invoice_conv;
69406         invoice_conv.inner = untag_ptr(invoice);
69407         invoice_conv.is_owned = ptr_is_owned(invoice);
69408         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69409         invoice_conv.is_owned = false;
69410         LDKThirtyTwoBytes payment_id_ref;
69411         CHECK(payment_id->arr_len == 32);
69412         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
69413         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69414         CHECK_ACCESS(retry_strategy_ptr);
69415         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69416         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69417         LDKChannelManager channelmanager_conv;
69418         channelmanager_conv.inner = untag_ptr(channelmanager);
69419         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69420         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69421         channelmanager_conv.is_owned = false;
69422         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
69423         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
69424         return tag_ptr(ret_conv, true);
69425 }
69426
69427 uint64_t  __attribute__((export_name("TS_preflight_probe_invoice"))) TS_preflight_probe_invoice(uint64_t invoice, uint64_t channelmanager, uint64_t liquidity_limit_multiplier) {
69428         LDKBolt11Invoice invoice_conv;
69429         invoice_conv.inner = untag_ptr(invoice);
69430         invoice_conv.is_owned = ptr_is_owned(invoice);
69431         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69432         invoice_conv.is_owned = false;
69433         LDKChannelManager channelmanager_conv;
69434         channelmanager_conv.inner = untag_ptr(channelmanager);
69435         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69436         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69437         channelmanager_conv.is_owned = false;
69438         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
69439         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
69440         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
69441         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
69442         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
69443         *ret_conv = preflight_probe_invoice(&invoice_conv, &channelmanager_conv, liquidity_limit_multiplier_conv);
69444         return tag_ptr(ret_conv, true);
69445 }
69446
69447 uint64_t  __attribute__((export_name("TS_preflight_probe_zero_value_invoice"))) TS_preflight_probe_zero_value_invoice(uint64_t invoice, int64_t amount_msat, uint64_t channelmanager, uint64_t liquidity_limit_multiplier) {
69448         LDKBolt11Invoice invoice_conv;
69449         invoice_conv.inner = untag_ptr(invoice);
69450         invoice_conv.is_owned = ptr_is_owned(invoice);
69451         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69452         invoice_conv.is_owned = false;
69453         LDKChannelManager channelmanager_conv;
69454         channelmanager_conv.inner = untag_ptr(channelmanager);
69455         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69456         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69457         channelmanager_conv.is_owned = false;
69458         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
69459         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
69460         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
69461         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
69462         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
69463         *ret_conv = preflight_probe_zero_value_invoice(&invoice_conv, amount_msat, &channelmanager_conv, liquidity_limit_multiplier_conv);
69464         return tag_ptr(ret_conv, true);
69465 }
69466
69467 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
69468         if (!ptr_is_owned(this_ptr)) return;
69469         void* this_ptr_ptr = untag_ptr(this_ptr);
69470         CHECK_ACCESS(this_ptr_ptr);
69471         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
69472         FREE(untag_ptr(this_ptr));
69473         PaymentError_free(this_ptr_conv);
69474 }
69475
69476 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
69477         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69478         *ret_copy = PaymentError_clone(arg);
69479         uint64_t ret_ref = tag_ptr(ret_copy, true);
69480         return ret_ref;
69481 }
69482 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
69483         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
69484         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
69485         return ret_conv;
69486 }
69487
69488 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
69489         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
69490         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69491         *ret_copy = PaymentError_clone(orig_conv);
69492         uint64_t ret_ref = tag_ptr(ret_copy, true);
69493         return ret_ref;
69494 }
69495
69496 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
69497         LDKStr a_conv = str_ref_to_owned_c(a);
69498         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69499         *ret_copy = PaymentError_invoice(a_conv);
69500         uint64_t ret_ref = tag_ptr(ret_copy, true);
69501         return ret_ref;
69502 }
69503
69504 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
69505         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
69506         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69507         *ret_copy = PaymentError_sending(a_conv);
69508         uint64_t ret_ref = tag_ptr(ret_copy, true);
69509         return ret_ref;
69510 }
69511
69512 jboolean  __attribute__((export_name("TS_PaymentError_eq"))) TS_PaymentError_eq(uint64_t a, uint64_t b) {
69513         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
69514         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
69515         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
69516         return ret_conv;
69517 }
69518
69519 void  __attribute__((export_name("TS_ProbingError_free"))) TS_ProbingError_free(uint64_t this_ptr) {
69520         if (!ptr_is_owned(this_ptr)) return;
69521         void* this_ptr_ptr = untag_ptr(this_ptr);
69522         CHECK_ACCESS(this_ptr_ptr);
69523         LDKProbingError this_ptr_conv = *(LDKProbingError*)(this_ptr_ptr);
69524         FREE(untag_ptr(this_ptr));
69525         ProbingError_free(this_ptr_conv);
69526 }
69527
69528 static inline uint64_t ProbingError_clone_ptr(LDKProbingError *NONNULL_PTR arg) {
69529         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
69530         *ret_copy = ProbingError_clone(arg);
69531         uint64_t ret_ref = tag_ptr(ret_copy, true);
69532         return ret_ref;
69533 }
69534 int64_t  __attribute__((export_name("TS_ProbingError_clone_ptr"))) TS_ProbingError_clone_ptr(uint64_t arg) {
69535         LDKProbingError* arg_conv = (LDKProbingError*)untag_ptr(arg);
69536         int64_t ret_conv = ProbingError_clone_ptr(arg_conv);
69537         return ret_conv;
69538 }
69539
69540 uint64_t  __attribute__((export_name("TS_ProbingError_clone"))) TS_ProbingError_clone(uint64_t orig) {
69541         LDKProbingError* orig_conv = (LDKProbingError*)untag_ptr(orig);
69542         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
69543         *ret_copy = ProbingError_clone(orig_conv);
69544         uint64_t ret_ref = tag_ptr(ret_copy, true);
69545         return ret_ref;
69546 }
69547
69548 uint64_t  __attribute__((export_name("TS_ProbingError_invoice"))) TS_ProbingError_invoice(jstring a) {
69549         LDKStr a_conv = str_ref_to_owned_c(a);
69550         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
69551         *ret_copy = ProbingError_invoice(a_conv);
69552         uint64_t ret_ref = tag_ptr(ret_copy, true);
69553         return ret_ref;
69554 }
69555
69556 uint64_t  __attribute__((export_name("TS_ProbingError_sending"))) TS_ProbingError_sending(uint64_t a) {
69557         void* a_ptr = untag_ptr(a);
69558         CHECK_ACCESS(a_ptr);
69559         LDKProbeSendFailure a_conv = *(LDKProbeSendFailure*)(a_ptr);
69560         a_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(a));
69561         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
69562         *ret_copy = ProbingError_sending(a_conv);
69563         uint64_t ret_ref = tag_ptr(ret_copy, true);
69564         return ret_ref;
69565 }
69566
69567 jboolean  __attribute__((export_name("TS_ProbingError_eq"))) TS_ProbingError_eq(uint64_t a, uint64_t b) {
69568         LDKProbingError* a_conv = (LDKProbingError*)untag_ptr(a);
69569         LDKProbingError* b_conv = (LDKProbingError*)untag_ptr(b);
69570         jboolean ret_conv = ProbingError_eq(a_conv, b_conv);
69571         return ret_conv;
69572 }
69573
69574 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) {
69575         void* amt_msat_ptr = untag_ptr(amt_msat);
69576         CHECK_ACCESS(amt_msat_ptr);
69577         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69578         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69579         void* payment_hash_ptr = untag_ptr(payment_hash);
69580         CHECK_ACCESS(payment_hash_ptr);
69581         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
69582         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
69583         LDKStr description_conv = str_ref_to_owned_c(description);
69584         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
69585         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
69586         if (phantom_route_hints_constr.datalen > 0)
69587                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
69588         else
69589                 phantom_route_hints_constr.data = NULL;
69590         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
69591         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
69592                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
69593                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
69594                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
69595                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
69596                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
69597                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
69598                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
69599         }
69600         FREE(phantom_route_hints);
69601         void* entropy_source_ptr = untag_ptr(entropy_source);
69602         CHECK_ACCESS(entropy_source_ptr);
69603         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69604         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69605                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69606                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69607         }
69608         void* node_signer_ptr = untag_ptr(node_signer);
69609         CHECK_ACCESS(node_signer_ptr);
69610         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69611         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69612                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69613                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69614         }
69615         void* logger_ptr = untag_ptr(logger);
69616         CHECK_ACCESS(logger_ptr);
69617         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69618         if (logger_conv.free == LDKLogger_JCalls_free) {
69619                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69620                 LDKLogger_JCalls_cloned(&logger_conv);
69621         }
69622         LDKCurrency network_conv = LDKCurrency_from_js(network);
69623         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69624         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69625         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69626         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69627         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69628         *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);
69629         return tag_ptr(ret_conv, true);
69630 }
69631
69632 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) {
69633         void* amt_msat_ptr = untag_ptr(amt_msat);
69634         CHECK_ACCESS(amt_msat_ptr);
69635         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69636         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69637         void* payment_hash_ptr = untag_ptr(payment_hash);
69638         CHECK_ACCESS(payment_hash_ptr);
69639         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
69640         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
69641         LDKSha256 description_hash_conv;
69642         description_hash_conv.inner = untag_ptr(description_hash);
69643         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69644         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69645         description_hash_conv = Sha256_clone(&description_hash_conv);
69646         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
69647         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
69648         if (phantom_route_hints_constr.datalen > 0)
69649                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
69650         else
69651                 phantom_route_hints_constr.data = NULL;
69652         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
69653         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
69654                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
69655                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
69656                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
69657                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
69658                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
69659                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
69660                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
69661         }
69662         FREE(phantom_route_hints);
69663         void* entropy_source_ptr = untag_ptr(entropy_source);
69664         CHECK_ACCESS(entropy_source_ptr);
69665         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69666         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69667                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69668                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69669         }
69670         void* node_signer_ptr = untag_ptr(node_signer);
69671         CHECK_ACCESS(node_signer_ptr);
69672         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69673         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69674                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69675                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69676         }
69677         void* logger_ptr = untag_ptr(logger);
69678         CHECK_ACCESS(logger_ptr);
69679         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69680         if (logger_conv.free == LDKLogger_JCalls_free) {
69681                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69682                 LDKLogger_JCalls_cloned(&logger_conv);
69683         }
69684         LDKCurrency network_conv = LDKCurrency_from_js(network);
69685         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69686         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69687         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69688         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69689         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69690         *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);
69691         return tag_ptr(ret_conv, true);
69692 }
69693
69694 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) {
69695         LDKChannelManager channelmanager_conv;
69696         channelmanager_conv.inner = untag_ptr(channelmanager);
69697         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69698         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69699         channelmanager_conv.is_owned = false;
69700         void* node_signer_ptr = untag_ptr(node_signer);
69701         CHECK_ACCESS(node_signer_ptr);
69702         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69703         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69704                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69705                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69706         }
69707         void* logger_ptr = untag_ptr(logger);
69708         CHECK_ACCESS(logger_ptr);
69709         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69710         if (logger_conv.free == LDKLogger_JCalls_free) {
69711                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69712                 LDKLogger_JCalls_cloned(&logger_conv);
69713         }
69714         LDKCurrency network_conv = LDKCurrency_from_js(network);
69715         void* amt_msat_ptr = untag_ptr(amt_msat);
69716         CHECK_ACCESS(amt_msat_ptr);
69717         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69718         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69719         LDKSha256 description_hash_conv;
69720         description_hash_conv.inner = untag_ptr(description_hash);
69721         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69722         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69723         description_hash_conv = Sha256_clone(&description_hash_conv);
69724         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69725         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69726         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69727         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69728         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69729         *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);
69730         return tag_ptr(ret_conv, true);
69731 }
69732
69733 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) {
69734         LDKChannelManager channelmanager_conv;
69735         channelmanager_conv.inner = untag_ptr(channelmanager);
69736         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69737         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69738         channelmanager_conv.is_owned = false;
69739         void* node_signer_ptr = untag_ptr(node_signer);
69740         CHECK_ACCESS(node_signer_ptr);
69741         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69742         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69743                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69744                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69745         }
69746         void* logger_ptr = untag_ptr(logger);
69747         CHECK_ACCESS(logger_ptr);
69748         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69749         if (logger_conv.free == LDKLogger_JCalls_free) {
69750                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69751                 LDKLogger_JCalls_cloned(&logger_conv);
69752         }
69753         LDKCurrency network_conv = LDKCurrency_from_js(network);
69754         void* amt_msat_ptr = untag_ptr(amt_msat);
69755         CHECK_ACCESS(amt_msat_ptr);
69756         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69757         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69758         LDKStr description_conv = str_ref_to_owned_c(description);
69759         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69760         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69761         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69762         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69763         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69764         *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);
69765         return tag_ptr(ret_conv, true);
69766 }
69767
69768 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) {
69769         LDKChannelManager channelmanager_conv;
69770         channelmanager_conv.inner = untag_ptr(channelmanager);
69771         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69772         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69773         channelmanager_conv.is_owned = false;
69774         void* node_signer_ptr = untag_ptr(node_signer);
69775         CHECK_ACCESS(node_signer_ptr);
69776         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69777         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69778                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69779                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69780         }
69781         void* logger_ptr = untag_ptr(logger);
69782         CHECK_ACCESS(logger_ptr);
69783         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69784         if (logger_conv.free == LDKLogger_JCalls_free) {
69785                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69786                 LDKLogger_JCalls_cloned(&logger_conv);
69787         }
69788         LDKCurrency network_conv = LDKCurrency_from_js(network);
69789         void* amt_msat_ptr = untag_ptr(amt_msat);
69790         CHECK_ACCESS(amt_msat_ptr);
69791         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69792         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69793         LDKStr description_conv = str_ref_to_owned_c(description);
69794         LDKThirtyTwoBytes payment_hash_ref;
69795         CHECK(payment_hash->arr_len == 32);
69796         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
69797         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69798         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69799         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69800         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69801         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69802         *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);
69803         return tag_ptr(ret_conv, true);
69804 }
69805
69806 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
69807         LDKStr s_conv = str_ref_to_owned_c(s);
69808         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
69809         *ret_conv = SiPrefix_from_str(s_conv);
69810         return tag_ptr(ret_conv, true);
69811 }
69812
69813 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
69814         LDKStr s_conv = str_ref_to_owned_c(s);
69815         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
69816         *ret_conv = Bolt11Invoice_from_str(s_conv);
69817         return tag_ptr(ret_conv, true);
69818 }
69819
69820 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
69821         LDKStr s_conv = str_ref_to_owned_c(s);
69822         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
69823         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
69824         return tag_ptr(ret_conv, true);
69825 }
69826
69827 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
69828         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
69829         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
69830         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69831         Str_free(ret_str);
69832         return ret_conv;
69833 }
69834
69835 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
69836         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
69837         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
69838         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69839         Str_free(ret_str);
69840         return ret_conv;
69841 }
69842
69843 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
69844         LDKBolt11Invoice o_conv;
69845         o_conv.inner = untag_ptr(o);
69846         o_conv.is_owned = ptr_is_owned(o);
69847         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69848         o_conv.is_owned = false;
69849         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
69850         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69851         Str_free(ret_str);
69852         return ret_conv;
69853 }
69854
69855 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
69856         LDKSignedRawBolt11Invoice o_conv;
69857         o_conv.inner = untag_ptr(o);
69858         o_conv.is_owned = ptr_is_owned(o);
69859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69860         o_conv.is_owned = false;
69861         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
69862         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69863         Str_free(ret_str);
69864         return ret_conv;
69865 }
69866
69867 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
69868         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
69869         LDKStr ret_str = Currency_to_str(o_conv);
69870         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69871         Str_free(ret_str);
69872         return ret_conv;
69873 }
69874
69875 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
69876         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
69877         LDKStr ret_str = SiPrefix_to_str(o_conv);
69878         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69879         Str_free(ret_str);
69880         return ret_conv;
69881 }
69882